[READ-ONLY] Mirror of https://github.com/andrioid/gostack-gql. Experiment: Generate GraphQL API (gqlgen) and DB functions (sqlc)
0

Configure Feed

Select the types of activity you want to include in your feed.

Go 80.8%
Shell 19.2%
10 1 0

Clone this repository

https://git.vm.fail/andri.dk/gostack-gql https://git.vm.fail/did:plc:wp4j7kmgyc6njscd3v6eis3s
ssh://git@knot1.tangled.sh:2222/andri.dk/gostack-gql ssh://git@knot1.tangled.sh:2222/did:plc:wp4j7kmgyc6njscd3v6eis3s

For self-hosted knots, clone URLs may differ based on your setup.


README.md

Experiment: gostack-gql#

Nothing fancy. Just trying out some basic backend. The main motivation is to see if it's viable to go schema-first for a backend application.

Database functions are generated from database migration files with sqlc and the API is generated from a GraphQL schema files using gqlgen.

The goal is to be able to focus on the business logic, and not re-implement things that are already defined in schemas.

Schemas as source of truth#

Database schema: goose#

  1. Add a new migration file into pkg/pgdb/schema
  2. Run the server (go run server.go)

Data management: sqlc#

  1. Add new queries or commands to pkg/pgdb/query.sql
  2. Run go generate ./...

GraphQL API: gqlgen#

  1. Make the necessary schema changes
  2. Run go generate ./...