Documentation ¶
Index ¶
- type QTNodeOperation
- type QTNodeSubscription
- type QTNodeUpdate
- type QueryTreeNode
- func (qt *QueryTreeNode) AddChild(data *proto.RGQLQueryTreeNode) (addChildErr error)
- func (qt *QueryTreeNode) ApplyTreeMutation(mutation *proto.RGQLQueryTreeMutation)
- func (qt *QueryTreeNode) Dispose()
- func (qt *QueryTreeNode) Done() <-chan struct{}
- func (qt *QueryTreeNode) Error() error
- func (qt *QueryTreeNode) SetError(err error)
- func (qt *QueryTreeNode) SubscribeChanges() QTNodeSubscription
- type SchemaResolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QTNodeOperation ¶
type QTNodeOperation int
const ( Operation_AddChild QTNodeOperation = iota Operation_DelChild Operation_Delete Operation_Error )
type QTNodeSubscription ¶
type QTNodeSubscription interface { Changes() <-chan *QTNodeUpdate Unsubscribe() }
A subscription to changes to the node
type QTNodeUpdate ¶
type QTNodeUpdate struct { Operation QTNodeOperation Child *QueryTreeNode }
A update to a QueryTreeNode
type QueryTreeNode ¶
type QueryTreeNode struct { Id uint32 Root *QueryTreeNode Parent *QueryTreeNode Children []*QueryTreeNode RootNodeMap map[uint32]*QueryTreeNode SchemaResolver SchemaResolver VariableStore *varstore.VariableStore FieldName string AST ast.TypeDefinition IsPrimitive bool PrimitiveName string Arguments map[string]*varstore.VariableReference // contains filtered or unexported fields }
QueryTreeNode is a node in a tree of fields that describes a query.
func NewQueryTree ¶
func NewQueryTree(rootQuery *ast.ObjectDefinition, schemaResolver SchemaResolver, errorCh chan<- *proto.RGQLQueryError) *QueryTreeNode
NewQueryTree builds a new query tree given the RootQuery AST object and a schemaResolver to lookup types.
func (*QueryTreeNode) AddChild ¶
func (qt *QueryTreeNode) AddChild(data *proto.RGQLQueryTreeNode) (addChildErr error)
AddChild validates and adds a child tree.
func (*QueryTreeNode) ApplyTreeMutation ¶
func (qt *QueryTreeNode) ApplyTreeMutation(mutation *proto.RGQLQueryTreeMutation)
ApplyTreeMutation applies a tree mutation to the query tree. Errors leave nodes in a failed state.
func (*QueryTreeNode) Dispose ¶
func (qt *QueryTreeNode) Dispose()
Dispose deletes the node and all children.
func (*QueryTreeNode) Done ¶
func (qt *QueryTreeNode) Done() <-chan struct{}
Done returns a channel that is closed when the node is disposed.
func (*QueryTreeNode) Error ¶
func (qt *QueryTreeNode) Error() error
Error returns any error the node might have. TODO: Add mechanism to communicate query tree errors.
func (*QueryTreeNode) SetError ¶
func (qt *QueryTreeNode) SetError(err error)
SetError marks a query tree node as invalid against the schema.
func (*QueryTreeNode) SubscribeChanges ¶
func (qt *QueryTreeNode) SubscribeChanges() QTNodeSubscription
SubscribeChanges subscribes to changes to the query tree node.
type SchemaResolver ¶
type SchemaResolver interface {
LookupType(ast.Type) ast.TypeDefinition
}
SchemaResolver is a object that can lookup AST types.