Documentation ¶
Overview ¶
Package gql provides a GraphQL client implementation for Golang.
For more information, see package github.com/machship-oss/go-gql
Status: In active early research and development.
For now, see README for more details.
Index ¶
- Variables
- type AddBaseInput
- type AddOp
- type AggregateArguments
- type AggregateOp
- type Base
- type BaseAggregate
- type BaseFields
- type BaseFilter
- type BaseGet
- type BaseHasChoice
- type BaseOrderChoice
- type BasePatch
- type BaseRef
- type Bool
- type DateTimeFilter
- type DateTimeRange
- type DeleteOp
- type Float64
- type GetOp
- type GqlError
- type GraphQL
- func (c *GraphQL) Add(ctx context.Context, op *AddOp) (err error)
- func (c *GraphQL) Aggregate(ctx context.Context, op *AggregateOp) (err error)
- func (c *GraphQL) BulkMutation(ctx context.Context, cont *MutationContainer) (err error)
- func (c *GraphQL) BulkQuery(ctx context.Context, cont *QueryContainer) (err error)
- func (c *GraphQL) Delete(ctx context.Context, op *DeleteOp) (err error)
- func (c *GraphQL) DoRaw(ctx context.Context, query string, vars map[string]interface{}, ...) (err error)
- func (c *GraphQL) Get(ctx context.Context, op *GetOp) (err error)
- func (c *GraphQL) Query(ctx context.Context, op *QueryOp) (err error)
- func (c *GraphQL) Update(ctx context.Context, op *UpdateOp) (err error)
- type GraphqlErrors
- type IAggregateResult
- type ID
- type IFilter
- type IIsAdd
- type IIsArg
- type IIsDelete
- type IIsGet
- type IIsUpdate
- type IMultiResult
- type IMutationResult
- type IOrder
- type ISingleResult
- type Int
- type Int64
- type MutationContainer
- type Point
- type QueryArguments
- type QueryContainer
- type QueryOp
- type String
- type StringFilter
- type Time
- type UpdateOp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrArgumentCouldNotBeEncodedAsJSON = errors.New("argument could not be encoded as JSON") ErrArgumentError = errors.New("unkown argument error") ErrArgumentsCannotBeEmpty = errors.New("arguments cannot be empty") ErrArgumentWasNotASliceOrArray = errors.New("argument was not a slice or array") ErrArgumentWasNotAStruct = errors.New("argument was not a struct") ErrJSONTagMissingOrNoValue = errors.New("json tag was missing or did not have a value") ErrNoIsResultTagFoundInFieldsOfStruct = errors.New("no isResult tag found in fields of struct") ErrOperationCouldNotBeGenerated = errors.New("operation could not be generated") ErrResultTypeNotHandled = errors.New("result type not handled") ErrResultWasNotASliceOrArray = errors.New("result was not a slice or array") ErrResultWasNotPointer = errors.New("result was not pointer") ErrResultWasNotPointerToStruct = errors.New("result was not pointer to struct") )
Functions ¶
This section is empty.
Types ¶
type AddBaseInput ¶
type AddBaseInput struct {
DateCreated *Time `json:"dateCreated,omitempty"`
}
type AddOp ¶
type AddOp struct { ResultObject IMutationResult Arguments IIsAdd // contains filtered or unexported fields }
type AggregateArguments ¶
type AggregateArguments struct {
Filter IFilter
}
type AggregateOp ¶
type AggregateOp struct { ResultObject IAggregateResult Arguments *AggregateArguments // contains filtered or unexported fields }
type BaseAggregate ¶
type BaseAggregate struct {
Count int `json:"count,omitempty"`
}
type BaseFields ¶
type BaseFields struct { }
type BaseFilter ¶
type BaseFilter struct { ID *ID `json:"id,omitempty"` DateCreated *DateTimeFilter `json:"dateCreated,omitempty"` }
type BaseHasChoice ¶
type BaseHasChoice string
const (
HC_BaseDateCreated BaseHasChoice = "dateCreated"
)
func (*BaseHasChoice) GetName ¶
func (c *BaseHasChoice) GetName() string
type BaseOrderChoice ¶
type BaseOrderChoice string
const (
OC_BaseDateCreated BaseOrderChoice = "dateCreated"
)
func (*BaseOrderChoice) GetName ¶
func (c *BaseOrderChoice) GetName() string
type DateTimeFilter ¶
type DateTimeRange ¶
type DeleteOp ¶
type DeleteOp struct { ResultObject IMutationResult Arguments IIsDelete // contains filtered or unexported fields }
type Float64 ¶
func NewFloat64 ¶
func NewFloat64Struct ¶
func (Float64) MarshalJSON ¶
func (*Float64) UnmarshalJSON ¶
type GetOp ¶
type GetOp struct { ResultObject ISingleResult Arguments IIsGet // contains filtered or unexported fields }
type GraphQL ¶
type GraphQL struct {
// contains filtered or unexported fields
}
Client is a GraphQL client.
func NewGraphQL ¶
NewClient creates a GraphQL client targeting the specified GraphQL server URL. If httpClient is nil, then http.DefaultClient is used.
func (*GraphQL) Aggregate ¶
func (c *GraphQL) Aggregate(ctx context.Context, op *AggregateOp) (err error)
func (*GraphQL) BulkMutation ¶
func (c *GraphQL) BulkMutation(ctx context.Context, cont *MutationContainer) (err error)
func (*GraphQL) BulkQuery ¶
func (c *GraphQL) BulkQuery(ctx context.Context, cont *QueryContainer) (err error)
type GraphqlErrors ¶
type GraphqlErrors []struct { Message string `json:"message"` Locations []struct { Line int `json:"line,omitempty"` Column int `json:"column,omitempty"` } `json:"locations,omitempty"` }
errors represents the "errors" array in a response from a GraphQL server. If returned via error interface, the slice is expected to contain at least 1 element.
Specification: https://facebook.github.io/graphql/#sec-Errors.
func (GraphqlErrors) Error ¶
func (e GraphqlErrors) Error() string
Error implements error interface.
type IAggregateResult ¶
type IAggregateResult interface {
AggregateResultName() string
}
type IMultiResult ¶
type IMultiResult interface {
MultiResultName() string
}
type IMutationResult ¶
type IMutationResult interface {
MutationName() string
}
type ISingleResult ¶
type ISingleResult interface {
SingleResultName() string
}
type MutationContainer ¶
type Point ¶
type Point struct { Latitude *Float64 `json:"latitude,omitempty"` Longitude *Float64 `json:"longitude,omitempty"` }
func NewPointStruct ¶
type QueryArguments ¶
type QueryContainer ¶
type QueryContainer struct { QueryOps []*QueryOp GetOps []*GetOp AggregateOps []*AggregateOp // contains filtered or unexported fields }
type QueryOp ¶
type QueryOp struct { ResultObject IMultiResult Arguments *QueryArguments // contains filtered or unexported fields }
type StringFilter ¶
type StringFilter struct {
Equal *String `json:"eq,omitempty"`
}
type UpdateOp ¶
type UpdateOp struct { ResultObject IMutationResult Arguments IIsUpdate // contains filtered or unexported fields }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.