Documentation ¶
Overview ¶
Package gql is responsible for lexing and parsing a GraphQL query/mutation.
Index ¶
- Constants
- Variables
- func ParseMutation(mutation string) (*api.Mutation, error)
- func ParseUid(xid string) (uint64, error)
- type Arg
- type Count
- type FilterTree
- type Function
- type GraphQuery
- type GroupByAttr
- type MathTree
- type Mutation
- type NQuad
- func (nq NQuad) CreateUidEdge(subjectUid uint64, objectUid uint64) *intern.DirectedEdge
- func (nq NQuad) CreateValueEdge(subjectUid uint64) (*intern.DirectedEdge, error)
- func (nq NQuad) ToDeletePredEdge() (*intern.DirectedEdge, error)
- func (nq NQuad) ToEdgeUsing(newToUid map[string]uint64) (*intern.DirectedEdge, error)
- type RecurseArgs
- type Request
- type Result
- type VarContext
- type Vars
Constants ¶
View Source
const ( ANY_VAR = 0 UID_VAR = 1 VALUE_VAR = 2 LIST_VAR = 3 )
Variables ¶
View Source
var (
ErrInvalidUID = errors.New("UID has to be greater than one.")
)
Functions ¶
Types ¶
type FilterTree ¶ added in v0.7.0
type FilterTree struct { Op string Child []*FilterTree Func *Function }
FilterTree is the result of parsing the filter directive. Either you can have `Op and Children` on non-leaf nodes Or Func at leaf nodes.
type Function ¶ added in v0.7.0
type Function struct { Attr string Lang string // language of the attribute value Name string // Specifies the name of the function. Args []Arg // Contains the arguments of the function. UID []uint64 NeedsVar []VarContext // If the function requires some variable IsCount bool // gt(count(friends),0) IsValueVar bool // eq(val(s), 5) }
Function holds the information about gql functions.
func (*Function) IsAggregator ¶ added in v0.7.3
func (*Function) IsPasswordVerifier ¶ added in v0.7.3
type GraphQuery ¶
type GraphQuery struct { UID []uint64 Attr string Langs []string Alias string IsCount bool IsInternal bool IsGroupby bool Var string NeedsVar []VarContext Func *Function Expand string // Which variable to expand with. Args map[string]string // Query can have multiple sort parameters. Order []*intern.Order Children []*GraphQuery Filter *FilterTree MathExp *MathTree Normalize bool Recurse bool RecurseArgs RecurseArgs Cascade bool IgnoreReflex bool Facets *intern.FacetParams FacetsFilter *FilterTree GroupbyAttrs []GroupByAttr FacetVar map[string]string FacetOrder string FacetDesc bool // Indicates whether count of uids is requested as a child node. If there // is an alias, then UidCountAlias will be set (otherwise it will be the // empty string). UidCount bool UidCountAlias string // True for blocks that don't have a starting function and hence no starting nodes. They are // used to aggregate and get variables defined in another block. IsEmpty bool // contains filtered or unexported fields }
GraphQuery stores the parsed Query in a tree format. This gets converted to intern.y used query.SubGraph before processing the query.
func (*GraphQuery) DebugPrint ¶ added in v0.7.0
func (gq *GraphQuery) DebugPrint(prefix string)
DebugPrint is useful for debugging.
type GroupByAttr ¶ added in v0.9.2
type NQuad ¶ added in v0.8.2
func (NQuad) CreateUidEdge ¶ added in v0.8.2
func (nq NQuad) CreateUidEdge(subjectUid uint64, objectUid uint64) *intern.DirectedEdge
func (NQuad) CreateValueEdge ¶ added in v0.8.2
func (nq NQuad) CreateValueEdge(subjectUid uint64) (*intern.DirectedEdge, error)
func (NQuad) ToDeletePredEdge ¶ added in v0.8.2
func (nq NQuad) ToDeletePredEdge() (*intern.DirectedEdge, error)
func (NQuad) ToEdgeUsing ¶ added in v0.8.2
ToEdgeUsing determines the UIDs for the provided XIDs and populates the xidToUid map.
type RecurseArgs ¶ added in v0.9.2
type Result ¶ added in v0.7.2
type Result struct { Query []*GraphQuery QueryVars []*Vars Schema *intern.SchemaRequest }
Result struct contains the Query list, its corresponding variable use list and the mutation block.
type VarContext ¶ added in v0.8.2
Click to show internal directories.
Click to hide internal directories.