Documentation
¶
Index ¶
- func AddV(label string) interfaces.Vertex
- func Constant(c string) interfaces.QueryBuilder
- func Escape(value string) string
- func Has(key string, value ...interface{}) interfaces.QueryBuilder
- func InE(labels ...string) interfaces.Edge
- func InV() interfaces.Vertex
- func NewEdgeG(g interfaces.Graph) interfaces.Edge
- func NewEdgeV(v interfaces.Vertex) interfaces.Edge
- func NewGraph(name string) interfaces.Graph
- func NewPropertyV(v interfaces.Vertex) interfaces.Property
- func NewSimpleQB(format string, a ...interface{}) interfaces.QueryBuilder
- func NewVertexE(e interfaces.Edge) interfaces.Vertex
- func NewVertexG(g interfaces.Graph) interfaces.Vertex
- func OutE(labels ...string) interfaces.Edge
- func OutV() interfaces.Vertex
- func SetQueryLanguageTo(ql QueryLanguage)
- func ShouldEscape(value string) bool
- func ShouldUnescape(value string) bool
- func ToValueMap(input []byte) (map[string]TypedValue, error)
- func UnEscape(value string) string
- func Unfold() interfaces.QueryBuilder
- type Edge
- type Property
- type QueryLanguage
- type ResponseArray
- type Type
- type TypedValue
- func (tv TypedValue) AsBool() bool
- func (tv TypedValue) AsBoolE() (bool, error)
- func (tv TypedValue) AsFloat64() float64
- func (tv TypedValue) AsFloat64E() (float64, error)
- func (tv TypedValue) AsInt32() int32
- func (tv TypedValue) AsInt32E() (int32, error)
- func (tv TypedValue) AsInt64E() (int64, error)
- func (tv TypedValue) AsString() string
- func (tv TypedValue) AsStringE() (string, error)
- func (tv TypedValue) String() string
- type ValueWithID
- type Vertex
- type VertexPropertyMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddV ¶ added in v0.1.13
func AddV(label string) interfaces.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.
func Constant ¶ added in v0.1.13
func Constant(c string) interfaces.QueryBuilder
Constant adds .constant() to the query.
func Escape ¶
Escape escapes all values that are not allowed to be stored directly into the cosmos-db.
func Has ¶ added in v0.1.19
func Has(key string, value ...interface{}) interfaces.QueryBuilder
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")
func InE ¶ added in v0.1.13
func InE(labels ...string) interfaces.Edge
InE adds .inE([<label_1>,<label_2>,..,<label_n>]), to the query. The query call returns all incoming edges of the Vertex
func InV ¶ added in v0.1.29
func InV() interfaces.Vertex
InV adds .inV(), to the query. The query call returns all incoming vertex of the edge
func NewEdgeG ¶
func NewEdgeG(g interfaces.Graph) interfaces.Edge
func NewEdgeV ¶
func NewEdgeV(v interfaces.Vertex) interfaces.Edge
func NewGraph ¶
func NewGraph(name string) interfaces.Graph
NewGraph creates a new graph query with the given name Hint: The actual graph has to exist on the server in order to execute the query that will be generated with this query builder
func NewPropertyV ¶ added in v0.1.7
func NewPropertyV(v interfaces.Vertex) interfaces.Property
func NewSimpleQB ¶
func NewSimpleQB(format string, a ...interface{}) interfaces.QueryBuilder
func NewVertexE ¶
func NewVertexE(e interfaces.Edge) interfaces.Vertex
func NewVertexG ¶
func NewVertexG(g interfaces.Graph) interfaces.Vertex
func OutE ¶ added in v0.1.13
func OutE(labels ...string) interfaces.Edge
OutE adds .outE([<label_1>,<label_2>,..,<label_n>]), to the query. The query call returns all outgoing edges of the Vertex
func OutV ¶ added in v0.1.16
func OutV() interfaces.Vertex
OutV adds .outV(), to the query. The query call returns all outgoing vertex of the edge
func SetQueryLanguageTo ¶ added in v0.1.3
func SetQueryLanguageTo(ql QueryLanguage)
SetQueryLanguageTo sets the query language that shall be used. Per default QueryLanguageCosmosDB is in use.
func ShouldEscape ¶
ShouldEscape returns true in case the given string needs to be escaped.
func ShouldUnescape ¶ added in v0.1.1
ShouldUnescape returns true in case the given string needs to be unescaped.
func ToValueMap ¶
func ToValueMap(input []byte) (map[string]TypedValue, error)
ToValueMap converts the given input byte array into a map of TypedValue's. The method will fail in case the data in the given byte array does not consist of key value pairs where these values are primitive types.
func UnEscape ¶
UnEscape reverses potentially applied escaping. In case of an error the original input value will be returned
func Unfold ¶ added in v0.1.13
func Unfold() interfaces.QueryBuilder
Unfold adds .unfold() to the query.
Types ¶
type Edge ¶
type Edge struct { ID string `mapstructure:"id"` Label string `mapstructure:"label"` Type Type `mapstructure:"type"` InVLabel string `mapstructure:"inVLabel"` InV string `mapstructure:"inV"` OutVLabel string `mapstructure:"outVLabel"` OutV string `mapstructure:"outV"` }
Edge represents the cosmos DB type for an edge. As it would be returned by a call to g.E().
type Property ¶
type Property struct { ID string `mapstructure:"id"` Value TypedValue `mapstructure:"value,squash"` Label string `mapstructure:"label"` }
Property represents the cosmos db type for a property. As it would be returned by a call to .properties().
func ToProperties ¶
ToProperties converts the given input byte array into an array of Property type. The method will fail in case the data in the given byte array does not contain values of type property.
type QueryLanguage ¶ added in v0.1.3
type QueryLanguage string
const ( QueryLanguageCosmosDB QueryLanguage = "cosmos" QueryLanguageTinkerpopGremlin QueryLanguage = "tinkerpop" )
type ResponseArray ¶
type ResponseArray []interfaces.Response
ResponseArray an array type for responses
func (ResponseArray) ToEdges ¶
func (responses ResponseArray) ToEdges() ([]Edge, error)
ToEdges converts the given ResponseArray into an array of Edge type. The method will fail in case the data in the given ResponseArray does not contain values of type edge.
func (ResponseArray) ToProperties ¶
func (responses ResponseArray) ToProperties() ([]Property, error)
ToProperties converts the given ResponseArray into an array of Property type. The method will fail in case the data in the given ResponseArray does not contain values of type property.
func (ResponseArray) ToValues ¶
func (responses ResponseArray) ToValues() ([]TypedValue, error)
ToValues converts the given ResponseArray into an array of TypedValue type. The method will fail in case the data in the given ResponseArray does not contain primitive values.
func (ResponseArray) ToVertices ¶
func (responses ResponseArray) ToVertices() ([]Vertex, error)
ToVertices converts the given ResponseArray into an array of Vertex type. The method will fail in case the data in the given ResponseArray does not contain values of type vertex.
type TypedValue ¶
type TypedValue struct {
Value interface{}
}
TypedValue represents the cosmos DB type for a value in case it is not used/ attached to a complex type.
func ToValues ¶
func ToValues(input []byte) ([]TypedValue, error)
ToValues converts the given input byte array into an array of TypedValue type. The method will fail in case the data in the given byte array does not contain primitive values.
func (TypedValue) AsBool ¶
func (tv TypedValue) AsBool() bool
func (TypedValue) AsBoolE ¶
func (tv TypedValue) AsBoolE() (bool, error)
func (TypedValue) AsFloat64 ¶
func (tv TypedValue) AsFloat64() float64
func (TypedValue) AsFloat64E ¶
func (tv TypedValue) AsFloat64E() (float64, error)
func (TypedValue) AsInt32 ¶
func (tv TypedValue) AsInt32() int32
func (TypedValue) AsInt32E ¶
func (tv TypedValue) AsInt32E() (int32, error)
func (TypedValue) AsInt64E ¶ added in v0.1.28
func (tv TypedValue) AsInt64E() (int64, error)
func (TypedValue) AsString ¶
func (tv TypedValue) AsString() string
func (TypedValue) AsStringE ¶
func (tv TypedValue) AsStringE() (string, error)
func (TypedValue) String ¶
func (tv TypedValue) String() string
type ValueWithID ¶
type ValueWithID struct { ID string `mapstructure:"id"` Value TypedValue `mapstructure:"value,squash"` }
ValueWithID represents the cosmos DB type for a value in case it is used/ attached to a complex type.
type Vertex ¶
type Vertex struct { Type Type `mapstructure:"type"` ID string `mapstructure:"id"` Label string `mapstructure:"label"` Properties VertexPropertyMap `mapstructure:"properties"` }
Vertex represents the cosmos DB type for an vertex. As it would be returned by a call to g.V().
func ToVertices ¶
ToVertices converts the given input byte array into an array of Vertex type. The method will fail in case the data in the given byte array does not contain values of type vertex.
type VertexPropertyMap ¶
type VertexPropertyMap map[string][]ValueWithID
func (VertexPropertyMap) AsString ¶
func (vpm VertexPropertyMap) AsString(key string) (string, error)
func (VertexPropertyMap) Value ¶
func (vpm VertexPropertyMap) Value(key string) (ValueWithID, bool)
Value returns the first value of the properties for this key the others are ignored. Anyway it is not possible to store multiple values for one property key.