This file contains hidden or 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
| func RegisterInput(schema *schemabuilder.Schema) { | |
| input := schema.InputObject("CreateCharacterRequest", CreateCharacterRequest{}) | |
| input.FieldFunc("name", func(target *CreateCharacterRequest, source string) { | |
| target.Name = source | |
| }) | |
| input.FieldFunc("type", func(target *CreateCharacterRequest, source Type) { | |
| target.Type = source | |
| }) | |
| } |
This file contains hidden or 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
| //import "go.appointy.com/jaal/schemabuilder" | |
| func RegisterPayload(schema *schemabuilder.Schema) { | |
| payload := schema.Object("Character", Character{}) | |
| payload.FieldFunc("id", func(ctx context.Context, in *Character) *schemabuilder.ID { | |
| return &schemabuilder.ID{Value: in.Id} | |
| }) | |
| payload.FieldFunc("name", func(ctx context.Context, in *Character) string { | |
| return in.Name | |
| }) |
This file contains hidden or 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
| // import "github.com/google/uuid" | |
| type Server struct { | |
| Characters []*Character | |
| } | |
| type Character struct { | |
| Id string | |
| Name string | |
| Type Type |
This file contains hidden or 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
| type Query { | |
| character(id: ID): Character | |
| characters: [Character!]! | |
| } | |
| type Mutation { | |
| createCharacter(input: CreateCharacterRequest): Character | |
| } | |
| type Character { |
NewerOlder