query

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessGraph

func ProcessGraph(ctx context.Context, sg *SubGraph, rch chan error)

ProcessGraph processes the SubGraph instance accumulating result for the query from different instances.

Types

type Codec added in v0.4.3

type Codec struct{}

Codec implements the custom codec interface.

func (*Codec) Marshal added in v0.4.3

func (c *Codec) Marshal(v interface{}) ([]byte, error)

Marshal release the graph.Node pointers after marshalling the response.

func (*Codec) String added in v0.4.3

func (c *Codec) String() string

func (*Codec) Unmarshal added in v0.4.3

func (c *Codec) Unmarshal(data []byte, v interface{}) error

Unmarshal constructs graph.Request from the byte slice.

type Latency

type Latency struct {
	Start          time.Time     `json:"-"`
	Parsing        time.Duration `json:"query_parsing"`
	Processing     time.Duration `json:"processing"`
	Json           time.Duration `json:"json_conversion"`
	ProtocolBuffer time.Duration `json:"pb_conversion"`
}

Latency is used to keep track of the latency involved in parsing and processing the query. It also contains information about the time it took to convert the result into a format(JSON/Protocol Buffer) that the client expects.

func (*Latency) ToMap

func (l *Latency) ToMap() map[string]string

ToMap converts the latency object to a map.

type ListChannel

type ListChannel struct {
	TList *task.UidList
	Idx   int
}

type SubGraph

type SubGraph struct {
	Attr     string
	Count    int
	Offset   int
	AfterUid uint64
	GetCount uint16
	Children []*SubGraph
	IsRoot   bool
	GetUid   bool

	Query  []byte // Contains list of source UIDs.
	Result []byte // Contains UID matrix or list of values for child attributes.
	// contains filtered or unexported fields
}

SubGraph is the way to represent data internally. It contains both the query and the response. Once generated, this can then be encoded to other client convenient formats, like GraphQL / JSON.

func ToSubGraph

func ToSubGraph(ctx context.Context, gq *gql.GraphQuery) (*SubGraph, error)

ToSubGraph converts the GraphQuery into the internal SubGraph instance type.

func (*SubGraph) ToJSON added in v0.4.4

func (sg *SubGraph) ToJSON(l *Latency) ([]byte, error)

ToJSON converts the internal subgraph object to JSON format which is then sent to the HTTP client.

func (*SubGraph) ToProtocolBuffer

func (sg *SubGraph) ToProtocolBuffer(l *Latency) (*graph.Node, error)

ToProtocolBuffer method transforms the predicate based subgraph to an predicate-entity based protocol buffer subgraph.

Directories

Path Synopsis
Package graph is a generated protocol buffer package.
Package graph is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL