Documentation ¶
Index ¶
- Constants
- Variables
- func CleanConditions(str string) string
- func CursorToOffset(cursor ConnectionCursor) (int, error)
- func ExtractConditions(sFilter string, bExtractForward bool) (pendingFilter string, curCondition string, curOperator string)
- func Filter(filterConditions string, val reflect.Value, arraySlice []interface{}) ([]interface{}, error)
- func FilterProfiles(filterConditions string, sortCond string, val reflect.Value, ...) ([]interface{}, int, error)
- func GetBalancePosition(sFilter string) (iBalancePos int, iLength int)
- func GetOffsetWithDefault(cursor ConnectionCursor, defaultOffset int) int
- func GetProfilesSubQueries(filterConditions string) ([]string, error)
- func GetQueryDetails(Query string) (Key string, Column string, Op string)
- func GetSubQueries(str, s1, s2 string) []string
- func GlobalIDField(typeName string, idFetcher GlobalIDFetcherFn) *graphql.Field
- func IsColumnNameValid(Column *string, val reflect.Value) bool
- func MergeFilterResults(dataMapLeft, dataMapRight map[int]DataSet, curOperation string) (map[int]DataSet, error)
- func MutationWithClientMutationID(config MutationConfig) *graphql.Field
- func NewConnectionArgs(configMap graphql.FieldConfigArgument) graphql.FieldConfigArgument
- func PluralIdentifyingRootField(config PluralIdentifyingRootFieldConfig) *graphql.Field
- func PriorityFilter(filterConditions string, val reflect.Value, arraySlice []interface{}) ([]interface{}, error)
- func ResolveFilterConditions(filter string, val reflect.Value, dataMap map[int]DataSet) (map[int]DataSet, error)
- func StringLessOp(strFirst, strSecond string) bool
- func ToGlobalID(ttype string, id string) string
- type ArraySliceMetaInfo
- type Connection
- type ConnectionArguments
- type ConnectionArgumentsConfig
- type ConnectionConfig
- type ConnectionCursor
- type DataSet
- type DataSorter
- type Edge
- type EdgeType
- type GlobalIDFetcherFn
- type GraphQLConnectionDefinitions
- type IDFetcherFn
- type MutationConfig
- type MutationFn
- type NodeDefinitions
- type NodeDefinitionsConfig
- type PageInfo
- type PluralIdentifyingRootFieldConfig
- type ResolveSingleInputFn
- type ResolvedGlobalID
- type SortBy
Constants ¶
const ENDBRACE = "}"
ENDBRACE : ENDBRACE is ending brace.
const INDCOL = "column"
INDCOL : INDCOL is column identifier.
const INDKEY = "key"
INDKEY : INDKEY is key identifier.
const INDOP = "op"
INDOP : INDCOP is operation identifier.
const NILQUERY = "NIL"
NILQUERY : NILQUERY is blank query.
const OPAND = "&"
OPAND : OPAND is and condition to join multile filer criteria.
const OPBLANK = ""
OPBLANK : OPBLANK is no operation specified.
const OPOR = "|"
OPOR : OPOR is or condition to join multile filer criteria.
const ORDASC = "ASC"
ORDASC : ORDASC is ascending Order.
const ORDDESC = "DESC"
ORDDESC : ORDDESC is descending Order.
const PREFIX = "arrayconnection:"
const ProfileKeyCheck = "profileScoreData.profileID"
KeyCheck : Profile ID needs column
const SEPDATA = ":"
SEPDATA : SEPDATA is data seperator.
const SEPENTRY = ","
SEPENTRY : SEPENTRY is entry seperator.
const SPACE = " "
SPACE : SPACE.
const STARTBRACE = "{"
STARTBRACE : STARTBRACE is starting brace.
Variables ¶
var ConnectionArgs = graphql.FieldConfigArgument{ "before": &graphql.ArgumentConfig{ Type: graphql.Int, }, "after": &graphql.ArgumentConfig{ Type: graphql.Int, }, "first": &graphql.ArgumentConfig{ Type: graphql.Int, }, "last": &graphql.ArgumentConfig{ Type: graphql.Int, }, "sort": &graphql.ArgumentConfig{ Type: graphql.String, }, "filter": &graphql.ArgumentConfig{ Type: graphql.String, }, }
Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field whose return type is a connection type.
Functions ¶
func CleanConditions ¶
CleanConditions : Function to Clean Sort Filter Conditions
func CursorToOffset ¶
func CursorToOffset(cursor ConnectionCursor) (int, error)
Re-derives the offset from the cursor string.
func ExtractConditions ¶
func ExtractConditions(sFilter string, bExtractForward bool) (pendingFilter string, curCondition string, curOperator string)
ExtractConditions : Extracts simplest conditions from complex conditions.
func Filter ¶
func Filter(filterConditions string, val reflect.Value, arraySlice []interface{}) ([]interface{}, error)
Filter : Filters data on given filterConditions.
func FilterProfiles ¶
func FilterProfiles(filterConditions string, sortCond string, val reflect.Value, arraySlice []interface{}) ([]interface{}, int, error)
FilterProfiles : Filters Profile data on given filterConditions.
func GetBalancePosition ¶
GetBalancePosition : Gets balancing position for condition.
func GetOffsetWithDefault ¶
func GetOffsetWithDefault(cursor ConnectionCursor, defaultOffset int) int
func GetProfilesSubQueries ¶
GetProfilesSubQueries : Function to Get Sub Queries with ProfileIDs
func GetQueryDetails ¶
GetQueryDetails : Function to Get Query Details
func GetSubQueries ¶
GetSubQueries : Function to Get Sub Queries
func GlobalIDField ¶
func GlobalIDField(typeName string, idFetcher GlobalIDFetcherFn) *graphql.Field
Creates the configuration for an id field on a node, using `toGlobalId` to construct the ID from the provided typename. The type-specific ID is fetcher by calling idFetcher on the object, or if not provided, by accessing the `id` property on the object.
func IsColumnNameValid ¶
IsColumnNameValid : To validate Column Name
func MergeFilterResults ¶
func MergeFilterResults(dataMapLeft, dataMapRight map[int]DataSet, curOperation string) (map[int]DataSet, error)
MergeFilterResults : Merges Filter Conditions results
func MutationWithClientMutationID ¶
func MutationWithClientMutationID(config MutationConfig) *graphql.Field
func NewConnectionArgs ¶
func NewConnectionArgs(configMap graphql.FieldConfigArgument) graphql.FieldConfigArgument
func PluralIdentifyingRootField ¶
func PluralIdentifyingRootField(config PluralIdentifyingRootFieldConfig) *graphql.Field
func PriorityFilter ¶
func PriorityFilter(filterConditions string, val reflect.Value, arraySlice []interface{}) ([]interface{}, error)
PriorityFilter : Filters data based on priority of given complex filterConditions.
func ResolveFilterConditions ¶
func ResolveFilterConditions(filter string, val reflect.Value, dataMap map[int]DataSet) (map[int]DataSet, error)
ResolveFilterConditions : Resolve Filter Conditions based on priority
func StringLessOp ¶
StringLessOp : Function to check Strings less operation
func ToGlobalID ¶
Takes a type name and an ID specific to that type name, and returns a "global ID" that is unique among all types.
Types ¶
type ArraySliceMetaInfo ¶
type Connection ¶
type Connection struct { Edges []*Edge `json:"edges"` PageInfo PageInfo `json:"pageInfo"` StaticInfo string `json:"staticInfo"` }
func ConnectionFromArray ¶
func ConnectionFromArray(data []interface{}, args ConnectionArguments, staticInfo string) *Connection
A simple function that accepts an array and connection arguments, and returns a connection object for use in GraphQL. It uses array offsets as pagination, so pagination will only work if the array is static.
func ConnectionFromArraySlice ¶
func ConnectionFromArraySlice( arraySlice []interface{}, args ConnectionArguments, meta ArraySliceMetaInfo, staticInfo string, ) *Connection
Given a slice (subset) of an array, returns a connection object for use in GraphQL.
This function is similar to `ConnectionFromArray`, but is intended for use cases where you know the cardinality of the connection, consider it too large to materialize the entire array, and instead wish pass in a slice of the total result large enough to cover the range specified in `args`.
func NewConnection ¶
func NewConnection() *Connection
type ConnectionArguments ¶
type ConnectionArguments struct { Before int `json:"before"` After int `json:"after"` First int `json:"first"` // -1 for undefined, 0 would return zero results Last int `json:"last"` // -1 for undefined, 0 would return zero results Sort ConnectionCursor `json:"sort"` Filter ConnectionCursor `json:"filter"` }
Use NewConnectionArguments() to properly initialize default values
func NewConnectionArguments ¶
func NewConnectionArguments(filters map[string]interface{}) ConnectionArguments
type ConnectionArgumentsConfig ¶
type ConnectionArgumentsConfig struct { Before int `json:"before"` After int `json:"after"` // use pointers for `First` and `Last` fields // so constructor would know when to use default values First *int `json:"first"` Last *int `json:"last"` Sort ConnectionCursor `json:"sort"` Filter ConnectionCursor `json:"filter"` }
type ConnectionConfig ¶
type ConnectionCursor ¶
type ConnectionCursor string
func CursorForObjectInConnection ¶
func CursorForObjectInConnection(data []interface{}, object interface{}) ConnectionCursor
Return the cursor associated with an object in an array.
func OffsetToCursor ¶
func OffsetToCursor(offset int) ConnectionCursor
Creates the cursor string from an offset
type DataSet ¶
type DataSet struct { CurRec interface{} // contains filtered or unexported fields }
DataSet : DataSet is data type used for filtering data.
type DataSorter ¶
type DataSorter struct {
// contains filtered or unexported fields
}
DataSorter : DataSorter combines SortBy function and data to sort
func (*DataSorter) Less ¶
func (s *DataSorter) Less(i, j int) bool
Less : Less will be called by calling SortBy closure in the sorter
func (*DataSorter) Swap ¶
func (s *DataSorter) Swap(i, j int)
Swap : Swap is function to swap elements
type EdgeType ¶
type EdgeType struct { Node interface{} `json:"node"` Cursor ConnectionCursor `json:"cursor"` }
type GlobalIDFetcherFn ¶
type GraphQLConnectionDefinitions ¶
type GraphQLConnectionDefinitions struct { EdgeType *graphql.Object `json:"edgeType"` ConnectionType *graphql.Object `json:"connectionType"` }
func ConnectionDefinitions ¶
func ConnectionDefinitions(config ConnectionConfig) *GraphQLConnectionDefinitions
type IDFetcherFn ¶
type MutationConfig ¶
type MutationConfig struct { Name string `json:"name"` InputFields graphql.InputObjectConfigFieldMap `json:"inputFields"` OutputFields graphql.Fields `json:"outputFields"` MutateAndGetPayload MutationFn `json:"mutateAndGetPayload"` }
A description of a mutation consumable by mutationWithClientMutationId to create a GraphQLField for that mutation.
The inputFields and outputFields should not include `clientMutationId`, as this will be provided automatically.
An input object will be created containing the input fields, and an object will be created containing the output fields.
mutateAndGetPayload will receive an Object with a key for each input field, and it should return an Object with a key for each output field. It may return synchronously, or return a Promise.
type MutationFn ¶
type NodeDefinitions ¶
func NewNodeDefinitions ¶
func NewNodeDefinitions(config NodeDefinitionsConfig) *NodeDefinitions
Given a function to map from an ID to an underlying object, and a function to map from an underlying object to the concrete GraphQLObjectType it corresponds to, constructs a `Node` interface that objects can implement, and a field config for a `node` root field. If the typeResolver is omitted, object resolution on the interface will be handled with the `isTypeOf` method on object types, as with any GraphQL
interface without a provided `resolveType` method.
type NodeDefinitionsConfig ¶
type NodeDefinitionsConfig struct { IDFetcher IDFetcherFn TypeResolve graphql.ResolveTypeFn }
type ResolveSingleInputFn ¶
type ResolveSingleInputFn func(input interface{}) interface{}
type ResolvedGlobalID ¶
func FromGlobalID ¶
func FromGlobalID(globalID string) *ResolvedGlobalID
Takes the "global ID" created by toGlobalID, and returns the type name and ID used to create it.