You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go mod tidy
sqlite3 cmd/server/data.db 'create table categories (id string, name string, description string);'
sqlite3 cmd/server/data.db 'create table courses (id string, name string, description string, category_id string);'cd cmd/server
go run server.go
Passos para trabalhar com graphql no go
Gerar o arquivo tools.go
printf'// +build tools\npackage tools\nimport (_ "github.com/99designs/gqlgen"\n _ "github.com/99designs/gqlgen/graphql/introspection")'| gofmt > tools.go
go mod tidy
Inicializar o gqlgen
go run github.com/99designs/gqlgen init && go mod tidy
Gerar arquivo de model para cada entidade da aplicação, na pasta graph/model, lembrando que não é nessecário colocar o campo 'Foreign Key' no objeto X que depende de Y
Definir, separadamente, no arquivo gqlgen.yml, os models das entidades da aplicação
go run github.com/99designs/gqlgen generate
Implementar os resolvers no arquivo graph/schema.resolvers.go