go-sqlc-clean-architecture-example

module
v0.0.0-...-5a404b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2024 License: MIT

README

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"

Directories

Path Synopsis
cmd
example command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL