Skip to content

rikeda71/go-gql-sqlc-template

Repository files navigation

go-gql-sqlc-template

Template Project of Web Backend API

Use Following Techstack

  • Go : Modern Programing Language
  • gqlgen : Use GraphQL Schema
  • sqlc : SQL based OR Mapper
  • dbmate : Migration Tool
  • task : Task Runner

Setup

Installation

Assuming the use of MacOS

  1. Install followings
  • Go 1.23
  • Docker Environmet (ex. Docker Desktop)
  1. Execute following commands

    $ go install github.com/go-task/task/v3/cmd/task@latest
    $ task setup
    # add 'export PATH="/opt/homebrew/opt/libpq/bin:$PATH"' to .zshrc etc.

Start API

$ task up
# wait a minutes...
$ task migrate # setup db

Test

$ task test

Integration Test

$ task integration-test

Development

Generate API I/F From Graphql Schema

$ task gql-gen

Generate DB I/F From SQL

# OR Mapper Code from DML
$ task sqlc-gen

# Model Code from DDL
$ task migrate # generate `db/schema.sql` through `dbmate migrate`
$ task sqlc-gen

DB Operations

# migrate
$ task migrate

# rollback
$ task rollback

About

Template Project with Go, gqlgen, and sqlc

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy