Documentation
¶
Index ¶
- func Escape(value string) string
- func NewEdgeG(g interfaces.Graph) interfaces.Edge
- func NewEdgeV(v interfaces.Vertex) interfaces.Edge
- func NewGraph(name string) interfaces.Graph
- func NewSimpleQB(format string, a ...interface{}) interfaces.QueryBuilder
- func NewVertexE(e interfaces.Edge) interfaces.Vertex
- func NewVertexG(g interfaces.Graph) 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
- 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) 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 Escape ¶
Escape escapes all values that are not allowed to be stored directly into the cosmos-db.
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 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 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.
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) 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.