Skip to content

Commit

Permalink
moves naming convention to a non-go standard
Browse files Browse the repository at this point in the history
  • Loading branch information
qhenkart committed May 1, 2019
1 parent 89c8734 commit bf2d07a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions codegen/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,9 @@ func (c *Config) InjectBuiltins(s *ast.Schema) {

// These are additional types that are injected if defined in the schema as scalars.
extraBuiltins := TypeMap{
"Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}},
"Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}},
"Interface": {Model: StringList{"github.com/99designs/gqlgen/graphql.Interface"}},
"Time": {Model: StringList{"github.com/99designs/gqlgen/graphql.Time"}},
"Map": {Model: StringList{"github.com/99designs/gqlgen/graphql.Map"}},
"Any": {Model: StringList{"github.com/99designs/gqlgen/graphql.Any"}},
}

for typeName, entry := range extraBuiltins {
Expand Down
6 changes: 3 additions & 3 deletions docs/content/reference/scalars.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ menu: { main: { parent: 'reference' } }

## Built-in helpers

gqlgen ships with three built-in helpers for common custom scalar use-cases, `Time`, `Interface` and `Map`. Adding any of these to a schema will automatically add the marshalling behaviour to Go types.
gqlgen ships with three built-in helpers for common custom scalar use-cases, `Time`, `Any` and `Map`. Adding any of these to a schema will automatically add the marshalling behaviour to Go types.

### Time

Expand All @@ -25,10 +25,10 @@ scalar Map

Maps an arbitrary GraphQL value to a `map[string]{interface}` Go type.

### Interface
### Any

```graphql
scalar Interface
scalar Any
```

Maps an arbitrary GraphQL value to a `interface{}` Go type.
Expand Down
4 changes: 2 additions & 2 deletions graphql/interface.go → graphql/any.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io"
)

func MarshalInterface(v interface{}) Marshaler {
func MarshalAny(v interface{}) Marshaler {
return WriterFunc(func(w io.Writer) {
err := json.NewEncoder(w).Encode(v)
if err != nil {
Expand All @@ -14,6 +14,6 @@ func MarshalInterface(v interface{}) Marshaler {
})
}

func UnmarshalInterface(v interface{}) (interface{}, error) {
func UnmarshalAny(v interface{}) (interface{}, error) {
return v, nil
}

0 comments on commit bf2d07a

Please sign in to comment.