Documentation ¶
Index ¶
- Constants
- Variables
- func HTTPDo(client *http.Client, r *http.Request, params DoParams) (result *graphql.Result, err error)
- func NewConnectionDef(schema *graphql.Object) *relay.GraphQLConnectionDefinitions
- func NewJSONObjectScalar(name string, description string) *graphql.Scalar
- func WithContext(ctx context.Context, gqlContext GraphQLContext) context.Context
- type APIErrorExtension
- func (a APIErrorExtension) ExecutionDidStart(ctx context.Context) (context.Context, graphql.ExecutionFinishFunc)
- func (a APIErrorExtension) GetResult(ctx context.Context) interface{}
- func (a APIErrorExtension) HasResult() bool
- func (a APIErrorExtension) Init(ctx context.Context, params *graphql.Params) context.Context
- func (a APIErrorExtension) Name() string
- func (a APIErrorExtension) ParseDidStart(ctx context.Context) (context.Context, graphql.ParseFinishFunc)
- func (a APIErrorExtension) ResolveFieldDidStart(ctx context.Context, info *graphql.ResolveInfo) (context.Context, graphql.ResolveFieldFinishFunc)
- func (a APIErrorExtension) ValidationDidStart(ctx context.Context) (context.Context, graphql.ValidationFinishFunc)
- type Connection
- type Cursor
- type DataLoader
- type DataLoaderInterface
- type DoParams
- type GraphQLContext
- type GraphiQL
- type Lazy
- type LazyItem
- type LoadFunc
- type PageArgs
- type PageResult
Constants ¶
View Source
const MaxPageSize uint64 = 100
Variables ¶
View Source
var Date = graphql.NewScalar(graphql.ScalarConfig{ Name: "Date", Description: "The `Date` scalar type represents a Date." + " The Date is serialized in ISO 8601 format", Serialize: serializeDate, ParseValue: unserializeDate, ParseLiteral: func(valueAST ast.Value) interface{} { switch valueAST := valueAST.(type) { case *ast.StringValue: return unserializeDate(valueAST.Value) } return nil }, })
Functions ¶
func HTTPDo ¶
func HTTPDo(client *http.Client, r *http.Request, params DoParams) (result *graphql.Result, err error)
HTTPDo is the HTTP version of graphql.Do.
func NewConnectionDef ¶
func NewJSONObjectScalar ¶
func WithContext ¶
func WithContext(ctx context.Context, gqlContext GraphQLContext) context.Context
Types ¶
type APIErrorExtension ¶
type APIErrorExtension struct{}
func (APIErrorExtension) ExecutionDidStart ¶
func (a APIErrorExtension) ExecutionDidStart(ctx context.Context) (context.Context, graphql.ExecutionFinishFunc)
func (APIErrorExtension) GetResult ¶
func (a APIErrorExtension) GetResult(ctx context.Context) interface{}
func (APIErrorExtension) HasResult ¶
func (a APIErrorExtension) HasResult() bool
func (APIErrorExtension) Name ¶
func (a APIErrorExtension) Name() string
func (APIErrorExtension) ParseDidStart ¶
func (a APIErrorExtension) ParseDidStart(ctx context.Context) (context.Context, graphql.ParseFinishFunc)
func (APIErrorExtension) ResolveFieldDidStart ¶
func (a APIErrorExtension) ResolveFieldDidStart(ctx context.Context, info *graphql.ResolveInfo) (context.Context, graphql.ResolveFieldFinishFunc)
func (APIErrorExtension) ValidationDidStart ¶
func (a APIErrorExtension) ValidationDidStart(ctx context.Context) (context.Context, graphql.ValidationFinishFunc)
type Connection ¶
type Connection struct { Edges []*relay.Edge `json:"edges"` PageInfo relay.PageInfo `json:"pageInfo"` TotalCount interface{} `json:"totalCount"` }
func NewConnectionFromArray ¶
func NewConnectionFromArray(data []interface{}, args relay.ConnectionArguments) *Connection
func NewConnectionFromResult ¶
func NewConnectionFromResult(lazyItems []LazyItem, result *PageResult) (*Connection, error)
type DataLoader ¶
type DataLoader struct { MaxBatch int // contains filtered or unexported fields }
func NewDataLoader ¶
func NewDataLoader(loadFn LoadFunc) *DataLoader
func (*DataLoader) Clear ¶
func (l *DataLoader) Clear(key interface{})
func (*DataLoader) ClearAll ¶
func (l *DataLoader) ClearAll()
func (*DataLoader) LoadMany ¶
func (l *DataLoader) LoadMany(ctx context.Context, keys []interface{}) *Lazy
func (*DataLoader) Prime ¶
func (l *DataLoader) Prime(key interface{}, value interface{})
type DataLoaderInterface ¶
type DoParams ¶
type DoParams struct { OperationName string `json:"operationName,omitempty"` Query string `json:"query"` Variables map[string]interface{} `json:"variables"` }
DoParams is the simplfied version of graphql.Params.
type GraphQLContext ¶
func GQLContext ¶
func GQLContext(ctx context.Context) GraphQLContext
type Lazy ¶
type Lazy struct {
// contains filtered or unexported fields
}
func NewLazyError ¶
func NewLazyValue ¶
func NewLazyValue(value interface{}) *Lazy
type LoadFunc ¶
LoadFunc must satisfy the following conditions.
1. The length of the result must match that of keys. 2. If a given key resolves to nothing, nil must be returned instead. 3. The order of the result must match that of keys.
So it is the responsibility of LoadFunc to satisfy these conditions. The underlying implementation used by LoadFunc may not satisfy the conditions.
type PageArgs ¶
func NewPageArgs ¶
func NewPageArgs(args relay.ConnectionArguments) PageArgs
type PageResult ¶
func NewPageResult ¶
func NewPageResult(args PageArgs, itemsLen int, totalCount *Lazy) *PageResult
Click to show internal directories.
Click to hide internal directories.