~louis77/pg2sqlite

6dd030c55533073034a94509d7fd1383af82abdf — Louis Brauer 2 months ago 400f424
Update README
Add Version to build filenames
4 files changed, 12 insertions(+), 7 deletions(-)

M README.md
M build.sh
M go.mod
M sqlite.go
M README.md => README.md +8 -4
@@ 1,5 1,9 @@
# pg2sqlite

[![Go Report Card](https://goreportcard.com/badge/louis77/pg2sqlite)](https://goreportcard.com/report/louis77/pg2sqlite)
[![License](https://img.shields.io/github/license/louis77/pg2sqlite)](https://img.shields.io/github/license/louis77/pg2sqlite)
[![Download](https://img.shields.io/github/downloads/louis77/pg2sqlite/total)](https://img.shields.io/github/downloads/louis77/pg2sqlite/total)

`pg2sqlite` can migrate tables from PostgreSQL to SQLite3.

## Installation


@@ 14,10 18,10 @@ $ go get -u git.sr.ht/~louis77/pg2sqlite

| Platform | Intel/AMD | ARM |
| -------- | ----- | --- |
| MacOS | [Intel](https://pg2sqlite.surge.sh/pg2sqlite-darwin-amd64.gz) | [M1](https://pg2sqlite.surge.sh/pg2sqlite-darwin-arm64.gz) |
| Linux | [amd64](https://pg2sqlite.surge.sh/pg2sqlite-linux-amd64.gz) | [arm](https://pg2sqlite.surge.sh/pg2sqlite-linux-arm64.gz) |
| FreeBSD | [amd64](https://pg2sqlite.surge.sh/pg2sqlite-freebsd-amd64.gz) | [arm64](https://pg2sqlite.surge.sh/pg2sqlite-freebsd-arm.gz) |
| Windows | [amd64](https://pg2sqlite.surge.sh/pg2sqlite-windows-amd64.exe.zip) | [arm](https://pg2sqlite.surge.sh/pg2sqlite-windows-arm.exe.zip) |
| MacOS | [Intel](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_darwin-amd64.gz) | [M1](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_darwin-arm64.gz) |
| Linux | [amd64](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_linux-amd64.gz) | [arm](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_linux-arm64.gz) |
| FreeBSD | [amd64](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_freebsd-amd64.gz) | [arm64](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_freebsd-arm.gz) |
| Windows | [amd64](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_windows-amd64.exe.zip) | [arm](https://pg2sqlite.surge.sh/pg2sqlite_1.0.0_windows-arm.exe.zip) |


## Usage

M build.sh => build.sh +2 -1
@@ 2,6 2,7 @@

builddir=build
name=pg2sqlite
version=$(cat VERSION)

declare -a goos=(  darwin darwin linux linux windows windows freebsd freebsd )
declare -a goarch=(amd64  arm64  amd64 arm64 amd64   arm     amd64   arm     )


@@ 30,7 31,7 @@ echo "Building pg2sqlite ..."
for K in "${!goos[@]}"; do
  current_os=${goos[$K]}
  current_arch=${goarch[$K]}
  product=$name-$current_os-$current_arch
  product="$name"_"$version"_$current_os-$current_arch
  if [ "$current_os" == "windows" ]; then product=$product.exe; fi
  echo Build "$K" : "$product"
  env GOOS="$current_os" GOARCH="$current_arch" go build -o $builddir/"$product"

M go.mod => go.mod +1 -1
@@ 1,4 1,4 @@
module git.sr.ht/~louis77/pg2sqlite
module github.com/louis77/pg2sqlite

go 1.16


M sqlite.go => sqlite.go +1 -1
@@ 140,7 140,7 @@ func InsertRow(tablename string, vals []interface{}) error {
		return fmt.Errorf("unable to determine affected rows: %w", err)
	}
	if affected != 1 {
		return fmt.Errorf("no row affected, this should not happend")
		return fmt.Errorf("no row affected, this should not happen")
	}

	return nil