Skip to content

Commit

Permalink
switch to swiftcarrot/gqlgen
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzuo committed May 22, 2021
1 parent b75df40 commit b5c59db
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 34 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.5.2

- switch to `github.com/swiftcarrot/gqlgen`

## 0.5.1

- fix `defer` in database template
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/spf13/cobra"
)

var Version = "0.5.1"
var Version = "0.5.2"

var versionCmd = &cobra.Command{
Use: "version",
Expand Down
6 changes: 3 additions & 3 deletions generators/graphql/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
"os"

"github.com/99designs/gqlgen/api"
"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/plugin/modelgen"
"github.com/swiftcarrot/dashi/plugin/resolvergen"
"github.com/swiftcarrot/genny"
"github.com/swiftcarrot/gqlgen/api"
"github.com/swiftcarrot/gqlgen/codegen/config"
"github.com/swiftcarrot/gqlgen/plugin/modelgen"
)

func New() (*genny.Generator, error) {
Expand Down
4 changes: 2 additions & 2 deletions generators/new/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func New(opts *Options) (*genny.Group, error) {
g.Command(exec.Command("go", "mod", "init"))
// TODO: lock package version
g.Command(exec.Command("go", "get", "github.com/swiftcarrot/dashi"))
g.Command(exec.Command("go", "get", "github.com/99designs/gqlgen@5ad012e3d7be1127706b9c8a3da0378df3a98ec1"))
// g.Command(exec.Command("go", "mod", "edit", "-replace=github.com/99designs/gqlgen=github.com/swiftcarrot/gqlgen@master"))
g.Command(exec.Command("go", "get", "github.com/swiftcarrot/gqlgen"))
// g.Command(exec.Command("go", "mod", "edit", "-replace=github.com/swiftcarrot/gqlgen=github.com/swiftcarrot/gqlgen@master"))

g.Templates(&templates)

Expand Down
8 changes: 4 additions & 4 deletions generators/new/templates/gqlgen.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ models:
- github.com/swiftcarrot/dashi/types.UUID
Int:
model:
- github.com/99designs/gqlgen/graphql.Int
- github.com/swiftcarrot/gqlgen/graphql.Int
UUID:
model:
- github.com/swiftcarrot/dashi/types.UUID
Expand All @@ -33,11 +33,11 @@ models:
- github.com/swiftcarrot/dashi/types.String
Float:
model:
- github.com/99designs/gqlgen/graphql.Float
- github.com/swiftcarrot/gqlgen/graphql.Float
Time:
model:
- github.com/99designs/gqlgen/graphql.Time
- github.com/swiftcarrot/gqlgen/graphql.Time
Map:
model:
- github.com/99designs/gqlgen/graphql.Map
- github.com/swiftcarrot/gqlgen/graphql.Map
- github.com/swiftcarrot/dashi/types/slices.Map
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dashboardgen

import (
"github.com/99designs/gqlgen/codegen"
"github.com/99designs/gqlgen/plugin"
"github.com/swiftcarrot/gqlgen/codegen"
"github.com/swiftcarrot/gqlgen/plugin"
)

type Plugin struct {
Expand Down
4 changes: 2 additions & 2 deletions generators/server/templates/api/server.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http"
"strconv"

"github.com/99designs/gqlgen/graphql"
"github.com/99designs/gqlgen/graphql/handler"
"github.com/swiftcarrot/gqlgen/graphql"
"github.com/swiftcarrot/gqlgen/graphql/handler"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
"github.com/go-chi/cors"
Expand Down
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/swiftcarrot/dashi
go 1.16

require (
github.com/99designs/gqlgen v0.0.0-00010101000000-000000000000
github.com/cockroachdb/cockroach-go v2.0.1+incompatible // indirect
github.com/fatih/color v1.11.0 // indirect
github.com/gobuffalo/envy v1.9.0 // indirect
Expand All @@ -25,9 +24,8 @@ require (
github.com/stretchr/testify v1.6.1
github.com/swiftcarrot/flect v0.3.2
github.com/swiftcarrot/genny v0.1.0
github.com/swiftcarrot/gqlgen v0.14.1
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 // indirect
golang.org/x/tools v0.0.0-20210106214847-113979e3529a
gopkg.in/yaml.v2 v2.3.0 // indirect
)

replace github.com/99designs/gqlgen => github.com/swiftcarrot/gqlgen v0.14.0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ github.com/swiftcarrot/flect v0.3.2 h1:WH26oFAfkyKYJQLlkN5Kw4XhwrHQTbMPIFLhjbuoW
github.com/swiftcarrot/flect v0.3.2/go.mod h1:Q8fbWSjfLnhQtOnE3Q8OtvH9PPIJoZdHp7QcbQ3zAPY=
github.com/swiftcarrot/genny v0.1.0 h1:jDCF8n/XZuQlEUr+TRVgfobDEe63xsRfIYobhftNrPg=
github.com/swiftcarrot/genny v0.1.0/go.mod h1:qIFsKAH9sJyxmxPA1UUscLv2Cq+oET8l9TqrRrCPF6Q=
github.com/swiftcarrot/gqlgen v0.14.0 h1:dCByJEX8B25brTmvHitEYuzVirePd77AiB1yrJu0izA=
github.com/swiftcarrot/gqlgen v0.14.0/go.mod h1:Q0Cu0QKR99SnpBtxxj4162MGz3jSkMWvgQ79g2YT6lA=
github.com/swiftcarrot/gqlgen v0.14.1 h1:Pix45lGD1weUf9m+Vwu3onw2vwjFa38bOlYffzRW9l0=
github.com/swiftcarrot/gqlgen v0.14.1/go.mod h1:/WrflvR8UlB/BDPbseZWtrEsKPl79FQfIcFEyZpNIH8=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
Expand Down
4 changes: 2 additions & 2 deletions plugin/resolvergen/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strings"
"text/template"

"github.com/99designs/gqlgen/codegen"
"github.com/99designs/gqlgen/codegen/templates"
"github.com/swiftcarrot/flect"
"github.com/swiftcarrot/gqlgen/codegen"
"github.com/swiftcarrot/gqlgen/codegen/templates"
)

//go:embed crud.tmpl
Expand Down
8 changes: 4 additions & 4 deletions plugin/resolvergen/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
"path/filepath"
"strings"

"github.com/99designs/gqlgen/codegen"
"github.com/99designs/gqlgen/codegen/config"
"github.com/99designs/gqlgen/codegen/templates"
"github.com/99designs/gqlgen/plugin"
"github.com/pkg/errors"
"github.com/swiftcarrot/dashi/generators/graphql/rewrite"
"github.com/swiftcarrot/gqlgen/codegen"
"github.com/swiftcarrot/gqlgen/codegen/config"
"github.com/swiftcarrot/gqlgen/codegen/templates"
"github.com/swiftcarrot/gqlgen/plugin"
)

//go:embed resolver.tmpl
Expand Down
4 changes: 2 additions & 2 deletions plugin/resolvergen/resolver.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

{{ reserveImport "github.com/vektah/gqlparser/v2" }}
{{ reserveImport "github.com/vektah/gqlparser/v2/ast" }}
{{ reserveImport "github.com/99designs/gqlgen/graphql" }}
{{ reserveImport "github.com/99designs/gqlgen/graphql/introspection" }}
{{ reserveImport "github.com/swiftcarrot/gqlgen/graphql" }}
{{ reserveImport "github.com/swiftcarrot/gqlgen/graphql/introspection" }}

{{ .Imports }}

Expand Down
2 changes: 1 addition & 1 deletion types/float.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/json"
"fmt"

"github.com/99designs/gqlgen/graphql"
"github.com/gobuffalo/nulls"
"github.com/swiftcarrot/gqlgen/graphql"
)

func MarshalNullsFloat(s nulls.Float64) graphql.Marshaler {
Expand Down
2 changes: 1 addition & 1 deletion types/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io"
"strconv"

"github.com/99designs/gqlgen/graphql"
"github.com/swiftcarrot/gqlgen/graphql"
)

func MarshalID(s string) graphql.Marshaler {
Expand Down
2 changes: 1 addition & 1 deletion types/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/json"
"fmt"

"github.com/99designs/gqlgen/graphql"
"github.com/gobuffalo/nulls"
"github.com/swiftcarrot/gqlgen/graphql"
)

func MarshalNullsInt(s nulls.Int) graphql.Marshaler {
Expand Down
2 changes: 1 addition & 1 deletion types/slices/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"io"

"github.com/99designs/gqlgen/graphql"
"github.com/swiftcarrot/gqlgen/graphql"
)

// Map is a map[string]interface.
Expand Down
2 changes: 1 addition & 1 deletion types/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package types
import (
"fmt"

"github.com/99designs/gqlgen/graphql"
"github.com/gobuffalo/nulls"
"github.com/gobuffalo/pop/slices"
"github.com/swiftcarrot/gqlgen/graphql"
)

func MarshalString(s string) graphql.Marshaler {
Expand Down
2 changes: 1 addition & 1 deletion types/time.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package types

import (
"github.com/99designs/gqlgen/graphql"
"github.com/gobuffalo/nulls"
"github.com/swiftcarrot/gqlgen/graphql"
)

func MarshalNullsTime(s nulls.Time) graphql.Marshaler {
Expand Down
2 changes: 1 addition & 1 deletion types/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package types
import (
"fmt"

"github.com/99designs/gqlgen/graphql"
"github.com/gobuffalo/nulls"
"github.com/gofrs/uuid"
"github.com/swiftcarrot/gqlgen/graphql"
)

func MarshalUUID(u uuid.UUID) graphql.Marshaler {
Expand Down

0 comments on commit b5c59db

Please sign in to comment.