Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONDecoder ¶
type JSONDecoder struct {
// contains filtered or unexported fields
}
JSONDecoder decodes a result tree to a JSON object.
func NewJSONDecoder ¶
func NewJSONDecoder(qt *QueryTree) *JSONDecoder
NewJSONDecoder builds a new json decoder. TODO: Arrays are currently unordered
func (*JSONDecoder) Access ¶
func (d *JSONDecoder) Access(cb func(map[string]interface{}))
Access locks the result and calls the callback. Do not mutate the result object.
func (*JSONDecoder) GetResultHandler ¶
func (d *JSONDecoder) GetResultHandler() ResultTreeHandler
GetResultHandler returns the result tree handler.
type PathCache ¶
type PathCache struct {
// contains filtered or unexported fields
}
PathCache implements a mutual path aliasing scheme with a server.
func NewPathCache ¶
func NewPathCache(size int, evictCb PathCacheEvictHandler) *PathCache
NewPathCache builds a path cache.
func (*PathCache) Get ¶
func (p *PathCache) Get(key uint32) *PathCursor
Get returns the value with the key.
func (*PathCache) Set ¶
func (p *PathCache) Set(key uint32, val *PathCursor)
Set sets a value in the cache.
type PathCacheEvictHandler ¶
type PathCacheEvictHandler func(*PathCursor)
PathCacheEvictHandler is called when a cursor is evicted from the cache.
type PathCursor ¶
type PathCursor struct {
// contains filtered or unexported fields
}
PathCursor points to a location in the result tree.
func NewPathCursor ¶
func NewPathCursor(qnode *qtNode, rnode *rtNode) *PathCursor
NewPathCursor builds a new path cursor.
func (*PathCursor) Apply ¶
func (c *PathCursor) Apply(val *proto.RGQLValue)
Apply applies the value segment to the cursor.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query is a query operation attached to a query tree.
type QueryTree ¶
type QueryTree struct {
// contains filtered or unexported fields
}
QueryTree manages merging Query fragments into a single query tree. This is a different implementation from qtree (the server-side implementation).
func NewQueryTree ¶
func NewQueryTree(schema *schema.Schema, handler QueryTreeHandler) (*QueryTree, error)
NewQueryTree builds the root of a query tree.
func (*QueryTree) StartQuery ¶
func (q *QueryTree) StartQuery(op *ast.OperationDefinition) (*Query, error)
StartQuery creates a new Query attached to the tree from a query fragment.
type QueryTreeHandler ¶
type QueryTreeHandler interface { // HandleMutation handles a change to the query tree. // The query ID is not filled in. HandleMutation(mut *proto.RGQLQueryTreeMutation) }
QueryTreeHandler handles changes to the query tree.
type ResultTree ¶
type ResultTree struct {
// contains filtered or unexported fields
}
ResultTree stores a RGQLValue result space. Subscribes to the "query node disposed" channel. The minimum depth disposed node is emitted on that channel (only). ResultTree stores the []RGQLValue series.
func NewResultTree ¶
func NewResultTree( qtree *QueryTree, cacheStrategy proto.RGQLValueInit_CacheStrategy, cacheSize int, ) (*ResultTree, error)
NewResultTree builds a new result tree.
func (*ResultTree) AddResultHandler ¶
func (r *ResultTree) AddResultHandler(handler ResultTreeHandler)
AddResultHandler adds a result tree handler. The entire contents of the existing tree are immediately sent to the handler.
func (*ResultTree) HandleValue ¶
func (r *ResultTree) HandleValue(va *proto.RGQLValue) error
HandleValue handles a rgql value stream. This must be called in the same order the messages were emitted. If an error is returned, behavior may be somewhat undefined.
func (*ResultTree) RemoveResultHandler ¶
func (r *ResultTree) RemoveResultHandler(handler ResultTreeHandler)
RemoveResultHandler removes a result tree handler.
type ResultTreeHandler ¶
type ResultTreeHandler interface { // HandleResultValue handles the next value in the sequence, optionally // returning a handler for the next value(s) in the sequence. HandleResultValue(val *proto.RGQLValue) ResultTreeHandler }
ResultTreeHandler handles a result value sequence.