Skip to content

MWT-proger/go-sqlc-clean-architecture-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-sqlc-clean-architecture-example

This is an example of how we can use the SQLC package and still follow the principles of a clean architecture.

Project Deployment

  1. Clone the repository to any suitable directory on your computer.
git clone https://github.com/MWT-proger/go-sqlc-clean-architecture-example.git
  1. Copy the template of the environment variables file.
  cp deployments/.env.example deployments/.env
  1. Specify the correct environment variables in the newly created file .env.

The following variables are available

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=testDB
POSTGRES_PORT=5432
  1. Run the Postgres database using the following command.
  docker compose -f deployments/docker-compose.yaml --env-file deployments/.env up -d
  1. Start the server.
go run ./cmd/example -a "localhost:8000" -d "user=postgres password=postgres host=localhost port=5432 dbname=testDB sslmode=disable"

About

This is an example of how we can use the SQLC package and still follow the principles of a clean architecture.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published