56 lines
		
	
	
		
			933 B
		
	
	
	
		
			GraphQL
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			933 B
		
	
	
	
		
			GraphQL
		
	
	
	
	
	
| # GraphQL schema example
 | |
| #
 | |
| # https://gqlgen.com/getting-started/
 | |
| 
 | |
| type Mutation
 | |
| 
 | |
| type Query
 | |
| 
 | |
| scalar UID
 | |
| 
 | |
| scalar Int64
 | |
| 
 | |
| """
 | |
| 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
 |