A framework for quickly starting a Go project
- Update the project information in the makefile
APP_NAME = go-project-startup
APP_DESC = go project startup template
BASE_PKG = github.com/zunkk
APP_PKG = $(BASE_PKG)/$(APP_NAME)
- Run update project information cmd
# This command will update the project name and go package
make reset-project-info
# This command will compile the program and deploy the binary copy to the deployment package
make dev-package
# Start in terminal
./deploy/app start
# Background startup
./deploy/start.sh
# This command will compile the program and package the script and binary into a compressed package
make package
Use sqlboiler to generate db models code.
-
Create/Update db tables
-
Update db information in
build/sqlboiler.toml
, default isPostgres
[psql]
dbname = "test"
host = "127.0.0.1"
port = 5432
user = "zunkk"
pass = "zunkk"
schema = "public"
sslmode = "disable"
- Update generate config
MODELS_PATH := ${PROJECT_PATH}/internal/core/model
DB_TYPE = psql
- Generate db models code
make generate-models