Documentation ¶
Index ¶
- Variables
- func Close()
- type Complex
- type ComplexParseError
- type ConnectOptions
- type DB
- type Driver
- type JSON
- type JSONParseError
- type Marshaler
- type Metadata
- type Node
- type Path
- type Properties
- func (p Properties) Keys() []string
- func (p Properties) MarshalTalon() ([]byte, error)
- func (p Properties) MarshaledProperties() (Properties, error)
- func (p Properties) Merge(other Properties) Properties
- func (p Properties) QueryString() string
- func (p Properties) String() string
- func (p *Properties) UnmarshalTalon(bs []byte) error
- func (p Properties) UnmarshaledProperties() (Properties, error)
- type Query
- type Relationship
- func (r *Relationship) Get(key string) (val interface{}, ok bool)
- func (r *Relationship) GetBool(key string) (bool, bool)
- func (r *Relationship) GetFloat(key string) (float64, bool)
- func (r *Relationship) GetInt(key string) (int64, bool)
- func (r *Relationship) GetString(key string) (string, bool)
- func (r *Relationship) Set(key string, val interface{})
- type Result
- type ResultStats
- type Row
- type Rows
- type UnmarshalType
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
var Unmarshalers = make(map[string]UnmarshalType)
Unmarshalers is a map of type keys to GenUnmarshaler functions for fetching types that convert strings into useful values for use.
Functions ¶
Types ¶
type Complex ¶
type Complex complex128
Complex wraps the native go complex128 type to allow conversion between complex values in Go and a string used to store such values in the database.
func NewComplex ¶
func NewComplex(i interface{}) Complex
NewComplex converts the complex64 or complex128 values into a Complex type for marshaling but if another type is given this returns 0.
func (Complex) MarshalTalon ¶
MarshalTalon takes a complex value and turns it into a string representation of itself.
func (*Complex) UnmarshalTalon ¶
UnmarshalTalon takes a string and should it parse correctly
type ComplexParseError ¶
type ComplexParseError string
ComplexParseError represents an error that occurred while parsing a complex value in string format.
func (ComplexParseError) Error ¶
func (cpe ComplexParseError) Error() string
Errror returns the message associated with this parse error.
type ConnectOptions ¶
ConnectOptions allows customiztaino of how to connect to a Neo4j database with talon.
func (ConnectOptions) Connect ¶
func (co ConnectOptions) Connect() (db *DB, err error)
Connect will take the provided connection options and attempt to establish a connection to a Neo4j database.
func (*ConnectOptions) URL ¶
func (co *ConnectOptions) URL() string
URL takes the options set for connection and generates a bolt connection string.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents a talon connection to a Neo4j database using Neo4j bolt behind the scenes.
func (*DB) Cypher ¶
Cypher returns a query read to run on Neo4j from a raw Cypher string. This method assumes there are no properties to be added to the query.
func (*DB) CypherP ¶
func (d *DB) CypherP(cypher string, p Properties) (*Query, error)
CypherP performs the same job as Cypher, it just allows the user to pass in a set of properties.
func (*DB) MustCypherP ¶
func (d *DB) MustCypherP(cypher string, p Properties) *Query
MustCypherP calls MustCypher but will panic on error.
type Driver ¶
Driver is an interface defining the requirement of a method that returns a bolt connection or error.
type JSON ¶
type JSON struct {
Data interface{}
}
JSON wraps an interface to provide a means for impelmenting the talon marshaling library.
func NewJSON ¶
func NewJSON(i interface{}) *JSON
NewJSON returns a pointer to the JSON type as a helper.
func (*JSON) Map ¶
Map returns the data (or nil) that is contained within this JSON value as a map[string]interface{}
func (*JSON) MarshalTalon ¶
MarshalTalon implements the talon.Marshaler interface for the JSON type.
func (*JSON) Slice ¶
func (j *JSON) Slice() []interface{}
Slice returns the data (or nil) that is contained within this JSON value as a []interface{}
func (*JSON) UnmarshalTalon ¶
UnmarshalTalon converts the JSON string back into a go type
type JSONParseError ¶
type JSONParseError string
JSONParseError represents an error parsing a JSON value stored in Neo4j
func (JSONParseError) Error ¶
func (jpe JSONParseError) Error() string
Error allows JSONParseError to match the error interface.
type Marshaler ¶
Marshaler represents a type that can turn itself into a string representation suitable for use with Talon query building.
type Metadata ¶
type Metadata struct { Fields []string // contains filtered or unexported fields }
Metadata contains details about the rows response, such as the field names from the query.
type Node ¶
type Node struct { ID int64 Labels []string Properties Properties }
Node represents a Neo4j Node type.
func (*Node) Get ¶
Get will fetch the property assocaited with the node, returning a bool to signify if the property did exist.
func (*Node) GetBool ¶
GetBool is similar to Get except it attempts to convert the found value to a bool (if it is a bool). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
func (*Node) GetFloat ¶
GetFloat is similar to get except it attempts to convert the found value to a float64 (if it is a float32 or float64). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
func (*Node) GetInt ¶
GetInt is similar to get except it handles fetching any integer type and converts it to an int64 (if it is any sized integer). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
type Path ¶
type Path []interface{}
Path represents a graph path, like node a -> rel 1 -> node b -> rel 2 -> node c or what-have-you.
type Properties ¶
type Properties map[string]interface{}
Properties is a map[string]interface{} wrapper with a special string function designed to produce properties for Neo4j.
func (Properties) Keys ¶
func (p Properties) Keys() []string
Keys returns an array of string values representing the keys in the map.
func (Properties) MarshalTalon ¶
func (p Properties) MarshalTalon() ([]byte, error)
MarshalTalon will marshal the Properties object using JSON.
func (Properties) MarshaledProperties ¶
func (p Properties) MarshaledProperties() (Properties, error)
MarshaledProperties will attempt to TalonMarshal all property values that can be marshaled.
func (Properties) Merge ¶
func (p Properties) Merge(other Properties) Properties
Merge merges the current Properties key/value pairs with those of the given Properties object. This does not modify the current or other input objects it instead returns a new Property map representing the merged properties.
func (Properties) QueryString ¶
func (p Properties) QueryString() string
QueryString produces a string of key: {key} mappings based on the structure of this object for use in queries.
func (Properties) String ¶
func (p Properties) String() string
String brings Properties inline with fmt.Stringer
func (*Properties) UnmarshalTalon ¶
func (p *Properties) UnmarshalTalon(bs []byte) error
UnmarshalTalon will convert a JSON value back into a properties value.
func (Properties) UnmarshaledProperties ¶
func (p Properties) UnmarshaledProperties() (Properties, error)
UnmarshaledProperties assumes that properties are raw strings from the database and examines them for potential type values.
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
Query reprsents a Talon query before it's been converted in Cypher
type Relationship ¶
type Relationship struct { ID int64 StartNodeID int64 EndNodeID int64 Name string Properties Properties Bounded bool }
Relationship represents a link between two nodes, it can come in two different kinds -- bounded or unbounded. If it's bounded then StartNodeID and EndNodeID will be set (and Bounded will be true). If it's unbounded these values will be 0.
func (*Relationship) Get ¶
func (r *Relationship) Get(key string) (val interface{}, ok bool)
Get will fetch the property assocaited with the relationship, returning a bool to signify if the property did exist.
func (*Relationship) GetBool ¶
func (r *Relationship) GetBool(key string) (bool, bool)
GetBool is similar to Get except it attempts to convert the found value to a bool (if it is a bool). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
func (*Relationship) GetFloat ¶
func (r *Relationship) GetFloat(key string) (float64, bool)
GetFloat is similar to get except it attempts to convert the found value to a float64 (if it is a float32 or float64). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
func (*Relationship) GetInt ¶
func (r *Relationship) GetInt(key string) (int64, bool)
GetInt is similar to get except it handles fetching any integer type and converts it to an int64 (if it is any sized integer). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
func (*Relationship) GetString ¶
func (r *Relationship) GetString(key string) (string, bool)
GetString performs the same function as get, except it handles fetching a string or string pointer value (if it is a string). Unlike Get, the type Get methods will return 'false' for it's second return if the value is not of the requested type.
func (*Relationship) Set ¶
func (r *Relationship) Set(key string, val interface{})
Set will assign the given value to the associated Key.
type Result ¶
type Result struct { Stats ResultStats Type string }
Result represents a return from a non-row based query like a create/delete or upate where you're not using something like "return" in the query.
type ResultStats ¶
type ResultStats struct { LabelsAdded int64 NodesCreated int64 PropertiesSet int64 NodesDeleted int64 RelationshipsCreated int64 RelationshipsDeleted int64 }
ResultStats are some details about the results of the query, such as the number of of nodes, labels and properties added/set.
type Row ¶
type Row struct { Metadata *Metadata // contains filtered or unexported fields }
Row represents a list of graph entities.
func (*Row) GetColumn ¶
GetColumn fetchs a column by it's associated name, so if you return the name 'node' in your query, you can fetch the value for that column via GetColumn("node").
type Rows ¶
type Rows struct { Metadata *Metadata // contains filtered or unexported fields }
Rows represents a group of rows fetched from a Cypher query.
type UnmarshalType ¶
UnmarshalType is a function that will take in a byte value and return an interface type (or error) when trying to Unmarshal.
type Unmarshaler ¶
Unmarshaler represents a type that is capable of converting a byte array into a Go valid representation of itself. If the byte array is malformed, then an error can be returned.