This boilerplate follow Clean Architecture, work best for monolith Go application with multiple domain modules.
Installation: https://golangci-lint.run/usage/install/#local-installation
Installation: https://pre-commit.com/#installation
After install pre-commit, run the following commands:
# Run pre-commit install to install pre-commit into your git hooks. pre-commit will now run on every commit.
pre-commit install
pre-commit install --hook-type commit-msg
Install goose
https://github.com/pressly/goose
go install github.com/pressly/goose/v3/cmd/[email protected]
goose -dir ./db/migrations create add_order_table sql
-- +goose Up
-- +goose StatementBegin
CREATE TABLE "public"."order"
(
"id" varchar NOT NULL,
"amount" varchar NOT NULL,
CONSTRAINT "order_pk" PRIMARY KEY ("id")
)
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS "public"."order";
-- +goose StatementEnd
goose -dir ./db/migrations postgres "postgresql://postgres:[email protected]:5435/db_name?sslmode=disable" up
[ ] CLI: run server, swagger file generate