-
Install gqlgen https://gqlgen.com/getting-started/ for generating graphql schema
-
Install go-migrate https://github.com/golang-migrate/migrate for running migration
gqlgen is a golang library to generate .graphql into golang code, so we only create schema or domain with .graphql files.
if you want to add or update graph/schema/schema.graphqls, you have to run below command.
go run github.com/99designs/gqlgen generate
Run below command to run migration
migrate -path migration -database "postgres://user:password@host:port/dbname?sslmode=disable&search_path=public" up
To create a new migration file
migrate create -ext sql -dir migration name
First install, you need to run setup.sh
./setup.sh
Run below command to run app server
go run cmd/product/main.go
To access GraphQL Playground
http://localhost:8080
Run unit test with below command in root folder
go test -v ./...
install golangci on local machine click here
Run golangci linter
golangci-lint run -v -c golangci.yml