-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1607 from 99designs/example-module
[POC/RFC] Split examples into separate go module
- Loading branch information
Showing
13 changed files
with
257 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package chat | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type Message struct { | ||
ID string `json:"id"` | ||
Text string `json:"text"` | ||
CreatedBy string `json:"createdBy"` | ||
CreatedAt time.Time `json:"createdAt"` | ||
} |
30 changes: 30 additions & 0 deletions
30
codegen/config/testdata/autobinding/scalars/model/model.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package model | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"strings" | ||
) | ||
|
||
type Banned bool | ||
|
||
func (b Banned) MarshalGQL(w io.Writer) { | ||
if b { | ||
w.Write([]byte("true")) | ||
} else { | ||
w.Write([]byte("false")) | ||
} | ||
} | ||
|
||
func (b *Banned) UnmarshalGQL(v interface{}) error { | ||
switch v := v.(type) { | ||
case string: | ||
*b = strings.ToLower(v) == "true" | ||
return nil | ||
case bool: | ||
*b = Banned(v) | ||
return nil | ||
default: | ||
return fmt.Errorf("%T is not a bool", v) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
module github.com/99designs/gqlgen/example | ||
|
||
go 1.17 | ||
|
||
replace github.com/99designs/gqlgen => ../ | ||
|
||
require ( | ||
github.com/99designs/gqlgen v0.0.0-00010101000000-000000000000 | ||
github.com/gorilla/websocket v1.4.2 | ||
github.com/mitchellh/mapstructure v1.4.1 | ||
github.com/opentracing/opentracing-go v1.2.0 | ||
github.com/rs/cors v1.8.0 | ||
github.com/stretchr/testify v1.7.0 | ||
github.com/vektah/dataloaden v0.3.0 | ||
github.com/vektah/gqlparser/v2 v2.2.0 | ||
sourcegraph.com/sourcegraph/appdash v0.0.0-20210831040556-ec77a7fbcadc | ||
) | ||
|
||
require ( | ||
github.com/agnivade/levenshtein v1.1.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/gorilla/mux v1.8.0 // indirect | ||
github.com/hashicorp/golang-lru v0.5.0 // indirect | ||
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381 // indirect | ||
github.com/mattn/go-colorable v0.1.4 // indirect | ||
github.com/mattn/go-isatty v0.0.12 // indirect | ||
github.com/opentracing/basictracer-go v1.1.0 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect | ||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect | ||
golang.org/x/mod v0.5.0 // indirect | ||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect | ||
golang.org/x/tools v0.1.5 // indirect | ||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect | ||
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect | ||
) |
Oops, something went wrong.