Skip to content

ViniciusReno/fomapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fomapi

Setup local development

Install tools

  • Docker desktop

  • TablePlus

  • Golang

  • Migrate

    $ curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add -
    $ echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/ focal main" > /etc/apt/sources.list.d/migrate.list
    $ apt-get update
    $ apt-get install -y migrate
  • Sqlc

    Ubuntu

    sudo snap install sqlc
    

    Docker

    docker pull kjconroy/sqlc
    

    Run sqlc using docker run:

    docker run --rm -v $(pwd):/src -w /src kjconroy/sqlc generate
    
  • Gomock

    go install github.com/golang/mock/[email protected]

Setup infrastructure

  • Start postgres container:

    make postgres
  • Create database:

    make createdb
  • Run db migration up all versions:

    make migrateup
  • Run db migration down all versions:

    make migratedown

How to generate code

  • Generate SQL CRUD with sqlc:

    make sqlc
  • Generate DB mock with gomock:

    make mock
  • Create a new db migration:

    migrate create -ext sql -dir db/migration -seq <migration_name>

How to run

  • Run server:

    make server
  • Run test:

    make test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published