-
$ curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add - $ echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/ focal main" > /etc/apt/sources.list.d/migrate.list $ apt-get update $ apt-get install -y migrate
-
sudo snap install sqlc
docker pull kjconroy/sqlc
Run
sqlc
usingdocker run
:docker run --rm -v $(pwd):/src -w /src kjconroy/sqlc generate
-
go install github.com/golang/mock/[email protected]
-
Start postgres container:
make postgres
-
Create database:
make createdb
-
Run db migration up all versions:
make migrateup
-
Run db migration down all versions:
make migratedown
-
Generate SQL CRUD with sqlc:
make sqlc
-
Generate DB mock with gomock:
make mock
-
Create a new db migration:
migrate create -ext sql -dir db/migration -seq <migration_name>
-
Run server:
make server
-
Run test:
make test