Documentation
¶
Index ¶
Constants ¶
const ( StatusSuccess = 200 StatusNoContent = 204 StatusPartialContent = 206 StatusAuthenticate = 407 StatusMalformedRequest = 498 StatusInvalidRequestArguments = 499 StatusServerError = 500 StatusScriptEvaluationError = 597 StatusServerTimeout = 598 StatusServerSerializationError = 599 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AsyncResponse ¶
type AsyncResponse struct { Response Response `json:"response"` //Partial Response object ErrorMessage string `json:"errorMessage"` // Error message if there was an error }
AsyncResponse structs holds the entire response from requests to the gremlin server
type Counter ¶
type Counter interface { // Count adds .count(), to the query. The query call will return the number of entities found in the query. Count() QueryBuilder }
type Dialer ¶
type Dialer interface { Connect() error IsConnected() bool Write([]byte) error Read() (int, []byte, error) Close() error Ping() error }
Dialer represents a entity that is able to open a websocket and work (read/ write) on it.
type Dropper ¶
type Dropper interface { // Drop adds .drop(), to the query. The query call will drop/ delete all referenced entities Drop() QueryBuilder }
type Edge ¶
type Edge interface { QueryBuilder Dropper Profiler Counter // To adds .to(<vertex>), to the query. The query call will be the second step to add an edge To(v Vertex) Edge // From adds .from(<vertex>), to the query. The query call will be the second step to add an edge From(v Vertex) Edge // OutV adds .outV(), to the query. The query call will return the vertices on the outgoing side of this edge OutV() Vertex // InV adds .inV(), to the query. The query call will return the vertices on the incoming side of this edge InV() Vertex // Add can be used to add a custom QueryBuilder // e.g. g.V().Add(NewSimpleQB(".myCustomCall('%s')",label)) Add(builder QueryBuilder) Edge // HasLabel adds .hasLabel([<label_1>,<label_2>,..,<label_n>]), e.g. .hasLabel('user','name'), to the query. The query call returns all edges with the given label. HasLabel(label ...string) Edge // Id adds .id(), to the query. The query call returns the id of the edge. Id() QueryBuilder // HasId adds .hasId('<id>'), e.g. .hasId('8aaaa410-dae1-4f33-8dd7-0217e69df10c'), to the query. The query call returns all edges // with the given id. HasId(id string) Edge // Limit adds .limit(<num>), to the query. The query call will limit the results of the query to the given number. Limit(maxElements int) Edge // As adds .as([<label_1>,<label_2>,..,<label_n>]), to the query to label that query step for later access. As(labels ...string) Edge }
type Graph ¶
type Graph interface { QueryBuilder // V adds .V() to the query. The query call returns all vertices. V() Vertex // VBy adds .V(<id>), e.g. .V(123), to the query. The query call returns the vertex with the given id. VBy(id int) Vertex // VByUUID adds .V(<id>), e.g. .V('8fff9259-09e6-4ea5-aaf8-250b31cc7f44'), to the query. The query call returns the vertex with the given id. VByUUID(id uuid.UUID) Vertex // VByStr adds .V(<id>), e.g. .V("123a"), to the query. The query call returns the vertex with the given id. VByStr(id string) Vertex // AddV adds .addV('<label>'), e.g. .addV('user'), to the query. The query call adds a vertex with the given label and returns that vertex. AddV(label string) Vertex // E adds .E() to the query. The query call returns all edges. E() Edge }
Graph represents a QueryBuilder that can be used to create queries on graph level
type Profiler ¶
type Profiler interface { // Profile adds .executionProfile(), to the query. The query call will return profiling information of the executed query Profile() QueryBuilder }
type Property ¶ added in v0.1.7
type Property interface { QueryBuilder Dropper Profiler Counter // Add can be used to add a custom QueryBuilder // e.g. g.V().properties("prop1").Add(NewSimpleQB(".myCustomCall('%s')",label)) Add(builder QueryBuilder) Property // Limit adds .limit(<num>), to the query. The query call will limit the results of the query to the given number. Limit(maxElements int) Property // As adds .as([<label_1>,<label_2>,..,<label_n>]), to the query to label that query step for later access. As(labels ...string) Property }
type QueryBuilder ¶
type QueryBuilder interface {
String() string
}
QueryBuilder can be used to generate queries for the cosmos db
type QueryExecutor ¶
type QueryExecutor interface { Close() error IsConnected() bool LastError() error Execute(query string) (resp []Response, err error) ExecuteAsync(query string, responseChannel chan AsyncResponse) (err error) ExecuteFileWithBindings(path string, bindings, rebindings map[string]interface{}) (resp []Response, err error) ExecuteFile(path string) (resp []Response, err error) ExecuteWithBindings(query string, bindings, rebindings map[string]interface{}) (resp []Response, err error) Ping() error }
type Response ¶
type Response struct { RequestID string `json:"requestId"` Status Status `json:"status"` Result Result `json:"result"` }
Response structs holds the entire response from requests to the gremlin server
type Result ¶
type Result struct { // Query Response Data Data json.RawMessage `json:"data"` Meta map[string]interface{} `json:"meta"` }
Result struct is used to hold properties returned for results from requests to the gremlin server
type Status ¶
type Status struct { Message string `json:"message"` Code int `json:"code"` Attributes map[string]interface{} `json:"attributes"` }
Status struct is used to hold properties returned from requests to the gremlin server
type Vertex ¶
type Vertex interface { QueryBuilder Dropper Profiler Counter // HasLabel adds .hasLabel([<label_1>,<label_2>,..,<label_n>]), e.g. .hasLabel('user','name'), to the query. The query call returns all vertices with the given label. HasLabel(vertexLabel ...string) Vertex // Property adds .property("<key>","<value>"), e.g. .property("name","hans") depending on the given type the quotes for the value are omitted. // e.g. .property("temperature",23.02) or .property("available",true) Property(key, value interface{}) Vertex // PropertyList adds .property(list,'<key>','<value>'), e.g. .property(list, 'name','hans'), to the query. The query call will add the given property. PropertyList(key, value string) Vertex // Properties adds .properties(), to the query. The query call returns all properties of the vertex. // The method can also be used to return only specific properties identified by their name. // Then .properties("<prop1 name>","<prop2 name>",...) will be added to the query. // v.Properties("prop1","prop2") Properties(key ...string) Property // Has adds .has("<key>","<value>"), e.g. .has("name","hans") depending on the given type the quotes for the value are omitted. // e.g. .has("temperature",23.02) or .has("available",true) // The method can also be used to return vertices that have a certain property. // Then .has("<prop name>") will be added to the query. // v.Has("prop1") Has(key string, value ...interface{}) Vertex // HasId adds .hasId('<id>'), e.g. .hasId('8aaaa410-dae1-4f33-8dd7-0217e69df10c'), to the query. The query call returns all vertices // with the given id. HasId(id string) Vertex // ValuesBy adds .values('<label>'), e.g. .values('user'), to the query. The query call returns all values of the vertex. ValuesBy(label string) QueryBuilder // Values adds .values(), to the query. The query call returns all values with the given label of the vertex. Values() QueryBuilder // ValueMap adds .valueMap(), to the query. The query call returns all values as a map of the vertex. ValueMap() QueryBuilder // Add can be used to add a custom QueryBuilder // e.g. g.V().Add(NewSimpleQB(".myCustomCall('%s')",label)) Add(builder QueryBuilder) Vertex // Id adds .id(), to the query. The query call returns the id of the vertex. Id() QueryBuilder // AddE adds .addE(<label>), to the query. The query call will be the first step to add an edge AddE(label string) Edge // OutE adds .outE([<label_1>,<label_2>,..,<label_n>]), to the query. The query call returns all outgoing edges of the Vertex OutE(labels ...string) Edge // InE adds .inE([<label_1>,<label_2>,..,<label_n>]), to the query. The query call returns all incoming edges of the Vertex InE(labels ...string) Edge // Limit adds .limit(<num>), to the query. The query call will limit the results of the query to the given number. Limit(maxElements int) Vertex // As adds .as([<label_1>,<label_2>,..,<label_n>]), to the query to label that query step for later access. As(labels ...string) Vertex }
Vertex represents a QueryBuilder that can be used to create queries on vertex level
type WebsocketConnection ¶
type WebsocketConnection interface { SetPongHandler(handler func(appData string) error) WriteMessage(messageType int, data []byte) error ReadMessage() (messageType int, p []byte, err error) Close() error WriteControl(messageType int, data []byte, deadline time.Time) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error }
WebsocketConnection is the minimal interface needed to act on a websocket