- dockerfile and docker-compose
- makfile
- live reloading
- viper
- cobra
- logrus
- echo
- gorm
- golang-migrate
cobra-cli add command_name
install:
go install github.com/cosmtrek/air@latest
change the setting in .air.toml
file
run it :
air -c .air.toml
clean_on_exit
option will delete the tmp
directory on air exit, change it if you don't want to.
create migration
migrate create -ext sql -dir internall/infrastructure/migration/ -seq init_mg
-seq
for sequential, UP
file for moving db to new state, DOWN
for reverting
apply migration
migrate -path internall/infrastructure/migration/ -database "postgresql://username:password@host:port/database_name?sslmode=disable" -verbose up
rollback
migrate -path internall/infrastructure/migration/ -database "postgresql://username:password@host:port/database_name?sslmode=disable" -verbose down