Documentation ¶
Index ¶
- Constants
- Variables
- func MakeObjectNullable(output graphql.Output) graphql.Output
- func ReflectStructFieldRecursive(fName string, t reflect.Type, param interface{}) reflect.Value
- func ReflectStructRecursive(t reflect.Type, param interface{}) reflect.Value
- type BuildObject
- type ConnectionACKMessage
- type FieldResolveFn
- type GomerInputObject
- type GomerObject
- type GomerTags
- type HandlerFn
- type Method
- type Object
- type SchemaBuilder
- func (s *SchemaBuilder) Build() (graphql.Schema, error)
- func (s *SchemaBuilder) CreateObjects() (map[string]graphql.Input, map[string]graphql.Output)
- func (s *SchemaBuilder) CreateObjectsFields() (map[string]graphql.Input, map[string]graphql.Output)
- func (s *SchemaBuilder) FindObjectsToBuild() (map[string]*BuildObject, map[string]*BuildObject)
- func (s *SchemaBuilder) Mutation() *Object
- func (s *SchemaBuilder) Object(name string, objType interface{}) *Object
- func (s *SchemaBuilder) Query() *Object
- func (s *SchemaBuilder) RegisterScalar(key string, sType *graphql.Scalar)
- func (s *SchemaBuilder) SetDefaultScalars()
- func (s *SchemaBuilder) Subscription() *SubscriptionObject
- type Selection
- type SelectionSet
- type Subscriber
- type SubscriptionHandler
- type SubscriptionMethod
- type SubscriptionObject
Constants ¶
View Source
const ( Query = "Query" Mutation = "Mutation" Subscription = "Subscription" )
View Source
const ( INPUT_TYPE = "INPUT_TYPE" OUTPUT_TYPE = "OUTPUT_TYPE" )
Variables ¶
View Source
var DecimalScalar = graphql.NewScalar(graphql.ScalarConfig{ Name: "Decimal", Description: ``, Serialize: func(value interface{}) interface{} { switch value := value.(type) { case *decimal.Decimal: return *value case decimal.Decimal: return value default: log.Errorf("Value is not decimal, actial type is %v", value) } return nil }, ParseValue: func(value interface{}) interface{} { switch value := value.(type) { case *decimal.Decimal: return *value case decimal.Decimal: return value case string: i, err := decimal.NewFromString(value) if err != nil { log.Errorf("Cannot convert %v to decimal, %s", value, err) } return i default: log.Errorf("Value is not decimal, actial type is %v", value) } return nil }, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: i, err := decimal.NewFromString(valueAST.Value) if err != nil { log.Error(err) } return i } return nil }, })
View Source
var Int64Scalar = graphql.NewScalar(graphql.ScalarConfig{ Name: "int64", Description: ``, Serialize: func(value interface{}) interface{} { switch value := value.(type) { case *int64: return *value case int64: return value default: log.Errorf("Value is not int64, actial type is %v", value) } return nil }, ParseValue: func(value interface{}) interface{} { switch value := value.(type) { case int64: return value case float64: return int64(value) case string: i, err := strconv.ParseInt(value, 10, 64) if err != nil { log.Errorf("Cannot convert %v to int64, %s", value, err) } return i default: log.Errorf("Value is not int64, actial type is %v", value) } return nil }, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.IntValue: i, err := strconv.ParseInt(valueAST.Value, 10, 64) if err != nil { log.Error(err) } return i } return nil }, })
Functions ¶
Types ¶
type BuildObject ¶ added in v0.1.31
type ConnectionACKMessage ¶
type FieldResolveFn ¶
type FieldResolveFn func() (interface{}, error)
type GomerInputObject ¶
type GomerInputObject struct { graphql.InputObject ArgsObject interface{} }
type GomerObject ¶
type GomerObject interface {
GetType() interface{}
}
type Object ¶
type Object struct { Name string Type interface{} Description string Resolver interface{} Args interface{} Methods map[string]*Method }
func (*Object) FieldResolver ¶
type SchemaBuilder ¶
type SchemaBuilder struct {
// contains filtered or unexported fields
}
func GetBuilder ¶
func GetBuilder() *SchemaBuilder
func (*SchemaBuilder) CreateObjects ¶
func (*SchemaBuilder) CreateObjectsFields ¶
func (*SchemaBuilder) FindObjectsToBuild ¶
func (s *SchemaBuilder) FindObjectsToBuild() (map[string]*BuildObject, map[string]*BuildObject)
func (*SchemaBuilder) Mutation ¶
func (s *SchemaBuilder) Mutation() *Object
func (*SchemaBuilder) Object ¶
func (s *SchemaBuilder) Object(name string, objType interface{}) *Object
func (*SchemaBuilder) Query ¶
func (s *SchemaBuilder) Query() *Object
func (*SchemaBuilder) RegisterScalar ¶
func (s *SchemaBuilder) RegisterScalar(key string, sType *graphql.Scalar)
func (*SchemaBuilder) SetDefaultScalars ¶
func (s *SchemaBuilder) SetDefaultScalars()
func (*SchemaBuilder) Subscription ¶
func (s *SchemaBuilder) Subscription() *SubscriptionObject
type Selection ¶
type Selection struct { Name string Alias string Args interface{} SelectionSet *SelectionSet }
func ParseSelections ¶
func ParseSelections(p graphql.ResolveParams, argsMap map[string]map[string]interface{}) []*Selection
type SelectionSet ¶
type SelectionSet struct {
Selections []*Selection
}
type Subscriber ¶
type SubscriptionHandler ¶
type SubscriptionHandler struct {
// contains filtered or unexported fields
}
func GetSubscriptionHandler ¶
func GetSubscriptionHandler(schema graphql.Schema) *SubscriptionHandler
func (*SubscriptionHandler) SubscriptionsHandlerFunc ¶
func (sh *SubscriptionHandler) SubscriptionsHandlerFunc(w http.ResponseWriter, r *http.Request)
type SubscriptionMethod ¶
type SubscriptionMethod struct { Name string Output interface{} Fn interface{} }
type SubscriptionObject ¶
type SubscriptionObject struct { Name string Description string Type interface{} Resolver interface{} Args interface{} Methods map[string]*SubscriptionMethod }
func (*SubscriptionObject) FieldSubscription ¶
func (s *SubscriptionObject) FieldSubscription(name string, output interface{}, handler interface{})
func (*SubscriptionObject) GetType ¶
func (s *SubscriptionObject) GetType() interface{}
Click to show internal directories.
Click to hide internal directories.