api: import github.com/99designs/gqlgen

Create a new generate.go file which imports github.com/99designs/gqlgen.
This fixes this kind of error because go mod now knows about the
dependency:

    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/cmd/gen.go:9:2: missing go.sum entry for module providing package github.com/urfave/cli/v2 (imported by github.com/99designs/gqlgen/cmd); to add:
    	go get github.com/99designs/gqlgen/cmd@v0.13.0
    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/internal/imports/prune.go:15:2: missing go.sum entry for module providing package golang.org/x/tools/go/ast/astutil (imported by github.com/99designs/gqlgen/internal/imports); to add:
    	go get github.com/99designs/gqlgen/internal/imports@v0.13.0
    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/internal/code/packages.go:8:2: missing go.sum entry for module providing package golang.org/x/tools/go/packages (imported by github.com/99designs/gqlgen/internal/code); to add:
    	go get github.com/99designs/gqlgen/internal/code@v0.13.0
    /home/simon/go/pkg/mod/github.com/99designs/gqlgen@v0.13.0/internal/imports/prune.go:16:2: missing go.sum entry for module providing package golang.org/x/tools/imports (imported by github.com/99designs/gqlgen/internal/imports); to add:
    	go get github.com/99designs/gqlgen/internal/imports@v0.13.0
    graph/resolver.go:7: running "go": exit status 1
    missing go.sum entry for module providing package github.com/vektah/dataloaden; to add:
    	go mod download github.com/vektah/dataloaden
    loaders/middleware.go:3: running "./gen": exit status 1
This commit is contained in:
Simon Ser 2022-01-12 13:29:28 +00:00 committed by Drew DeVault
parent 4090f16880
commit c718de746e
2 changed files with 28 additions and 20 deletions

10
api/graph/generate.go Normal file
View File

@ -0,0 +1,10 @@
//go:build generate
// +build generate
package graph
import (
_ "github.com/99designs/gqlgen"
)
//go:generate go run github.com/99designs/gqlgen

View File

@ -6,30 +6,28 @@ import (
"git.sr.ht/~sircmpwn/todo.sr.ht/api/graph/model"
)
//go:generate go run github.com/99designs/gqlgen
type Resolver struct{}
var (
trackerNameRE = regexp.MustCompile(`^[A-Za-z0-9._-]+$`)
trackerNameRE = regexp.MustCompile(`^[A-Za-z0-9._-]+$`)
)
func aclBits(input model.ACLInput) uint {
var bits uint
if input.Browse {
bits |= model.ACCESS_BROWSE
}
if input.Submit {
bits |= model.ACCESS_SUBMIT
}
if input.Comment {
bits |= model.ACCESS_COMMENT
}
if input.Edit {
bits |= model.ACCESS_EDIT
}
if input.Triage {
bits |= model.ACCESS_TRIAGE
}
return bits
var bits uint
if input.Browse {
bits |= model.ACCESS_BROWSE
}
if input.Submit {
bits |= model.ACCESS_SUBMIT
}
if input.Comment {
bits |= model.ACCESS_COMMENT
}
if input.Edit {
bits |= model.ACCESS_EDIT
}
if input.Triage {
bits |= model.ACCESS_TRIAGE
}
return bits
}