2024-11-01 14:25:30 +00:00
|
|
|
# GraphQL schema example
|
|
|
|
#
|
|
|
|
# https://gqlgen.com/getting-started/
|
|
|
|
|
|
|
|
type Mutation
|
|
|
|
|
2024-11-15 16:12:15 +00:00
|
|
|
type Query
|
2024-11-01 14:25:30 +00:00
|
|
|
|
|
|
|
"""
|
|
|
|
Maps a Time GraphQL scalar to a Go time.Time struct.
|
|
|
|
"""
|
|
|
|
scalar Time
|
|
|
|
|
|
|
|
"""
|
|
|
|
type Map(Go type: map[string]interface{})
|
|
|
|
"""
|
|
|
|
scalar Map
|
|
|
|
|
|
|
|
"""
|
|
|
|
Go type interface{}
|
|
|
|
"""
|
|
|
|
scalar Any
|
|
|
|
scalar Void
|
|
|
|
|
|
|
|
"""
|
|
|
|
directive to map Go type
|
|
|
|
type User @goModel(model: "github.com/my/app/models.User") {
|
|
|
|
id: ID! @goField(name: "todoId")
|
|
|
|
name: String!
|
|
|
|
@goField(forceResolver: true)
|
|
|
|
@goTag(key: "xorm", value: "-")
|
|
|
|
@goTag(key: "yaml")
|
|
|
|
}
|
|
|
|
"""
|
|
|
|
directive @goModel(
|
|
|
|
model: String
|
|
|
|
models: [String!]
|
|
|
|
forceGenerate: Boolean
|
|
|
|
) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION
|
|
|
|
|
|
|
|
"""
|
|
|
|
directive to map Go type
|
|
|
|
"""
|
|
|
|
directive @goField(
|
|
|
|
forceResolver: Boolean
|
|
|
|
name: String
|
|
|
|
omittable: Boolean
|
|
|
|
) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|
|
|
|
|
|
|
|
directive @goTag(key: String!, value: String) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION
|