Documentation ¶
Index ¶
- Constants
- func Collect(from QueryResult, err error) ([]RecordMap, Neo4GoError)
- func GetValueElem(val reflect.Value) reflect.Value
- func IsAuthError(err error) bool
- func IsClientError(err error) bool
- func IsDecodingError(err error) bool
- func IsInitError(err error) bool
- func IsNil(val reflect.Value) bool
- func IsQueryError(err error) bool
- func IsSecurityError(err error) bool
- func IsServiceUnavailableError(err error) bool
- func IsSessionError(err error) bool
- func IsTransactionError(err error) bool
- func IsTransientError(err error) bool
- func IsTypeError(err error) bool
- func IsUnknownError(err error) bool
- func IsWriteQuery(query string) bool
- func NewManager(options ManagerOptions) (Manager, Neo4GoError)
- func Single(from QueryResult, err error) (*RecordMap, Neo4GoError)
- type Decoder
- type EncodeHookFunc
- type Encoder
- type EncoderOptions
- type InputOtherType
- type InputStruct
- func NewInputArray(value []InputStruct) InputStruct
- func NewInputBool(value *bool) InputStruct
- func NewInputByteArray(value []byte) InputStruct
- func NewInputDateTime(value *time.Time) InputStruct
- func NewInputFloat(value *float64) InputStruct
- func NewInputInteger(value *int64) InputStruct
- func NewInputMap(value map[string]InputStruct) InputStruct
- func NewInputPoint(value *neo4j.Point) InputStruct
- func NewInputString(value *string) InputStruct
- func NewInputUnsignedInteger(value *uint64) InputStruct
- type Manager
- type ManagerOptions
- type Neo4GoError
- type QueryParams
- type QueryResult
- type RecordArray
- type RecordMap
- func (rec *RecordMap) DecodeNode(decoder Decoder, nodeName string, outpout interface{}) Neo4GoError
- func (rec *RecordMap) DecodePath(decoder Decoder, pathName string, outputNode interface{}, ...) Neo4GoError
- func (rec *RecordMap) DecodeRelation(decoder Decoder, relationName string, outpout interface{}) Neo4GoError
- func (rec *RecordMap) IsEmpty() bool
- func (rec *RecordMap) RawMap() map[string]interface{}
- type TransactionParams
Constants ¶
const ( INCLUDE_NIL_IN_RECORDS queryOutputFlag = 1 << iota KEEP_EMPTY_MAPS )
Variables ¶
This section is empty.
Functions ¶
func Collect ¶
func Collect(from QueryResult, err error) ([]RecordMap, Neo4GoError)
Collect loops through the result stream, collects records into a slice and returns the resulting slice. Any error passed in or reported while navigating the result stream is returned without any conversion. This function is nearly entirely copied from https://github.com/neo4j/neo4j-go-driver/blob/4.3/neo4j/result_helpers.go
func GetValueElem ¶
GetValueElem returns the underlying value of a reflected value and passes through pointers/interfaces
func IsAuthError ¶
IsAuthError tells if the error is a neo4go Auth error
func IsClientError ¶
IsClientError tells if the error is a neo4go Client error
func IsDecodingError ¶
IsDecodingError tells if the error is a neo4go Decoding error
func IsInitError ¶
IsInitError tells if the error is a neo4go Init error
func IsNil ¶
IsNil tells if the value can be used or not (as a plain object or as a dereferenceable pointer)
func IsQueryError ¶
IsQueryError tells if the error is a neo4go Query error
func IsSecurityError ¶
IsSecurityError tells if the error is a neo4go Security error
func IsServiceUnavailableError ¶
IsServiceUnavailableError tells if the error is a neo4go Service Unavailable error
func IsSessionError ¶
IsSessionError tells if the error is a neo4go Session error
func IsTransactionError ¶
IsTransactionError tells if the error is a neo4go Query error
func IsTransientError ¶
IsTransientError tells if the error is a neo4go Transient error
func IsTypeError ¶
IsTypeError tells if the error is a neo4go Type error
func IsUnknownError ¶
IsUnknownError tells if the error is a neo4go Unknown error
func IsWriteQuery ¶
IsWriteQuery determines if the given cypher query's type is write or read
func NewManager ¶
func NewManager(options ManagerOptions) (Manager, Neo4GoError)
NewManager creates a new instance of Manager, with a given config.
func Single ¶
func Single(from QueryResult, err error) (*RecordMap, Neo4GoError)
Single returns one and only one record from the result stream. Any error passed in or reported while navigating the result stream is returned without any conversion. If the result stream contains zero or more than one records error is returned. This function is nearly entirely copied from https://github.com/neo4j/neo4j-go-driver/blob/4.3/neo4j/result_helpers.go
Types ¶
type Decoder ¶
type Decoder interface { // DecodeNode takes a node like object (pointers and lists are accepted) and decodes it in the second argument DecodeNode(interface{}, interface{}) Neo4GoError // DecodeNode takes a relationship like object (pointers and lists are accepted) and decodes it in the second argument DecodeRelationship(interface{}, interface{}) Neo4GoError // DecodeNode takes a path like object (pointers are accepted) and decodes its nodes in the second argument and its relationships in the third DecodePath(interface{}, interface{}, interface{}) Neo4GoError // DecodeRecordMap takes a record map and decodes its raw values into the fields of the output DecodeRecordMap(RecordMap, interface{}) Neo4GoError }
Decoder allows a user to decode Node, Relationship or Path object from the Neo4J driver as custom struct fields, provided the right pointer and that the struct has the right tags on its fields
func NewDecoder ¶
func NewDecoder(options *mapstructure.DecoderConfig) Decoder
NewDecoder creates a new instance of Decoder, with a given config. A nil config will result in the default config beinng applied
type EncodeHookFunc ¶
type EncodeHookFunc func(reflect.Value, interface{}) (InputStruct, bool)
EncodeHookFunc represents a function that converts a specific type of value into a neo4go query input
func ComposeEncodeHookFunc ¶
func ComposeEncodeHookFunc(hooks ...EncodeHookFunc) EncodeHookFunc
ComposeEncodeHookFunc allows to compose multiple encoding functions into one in order to pass it to an Encoder
type Encoder ¶
type Encoder interface { // Encode takes any object and encodes it into an object accepted by the neo4go query system Encode(interface{}) InputStruct }
Encoder allows a user to encode any type of data (including custom structs) into neo4go query input values
func NewEncoder ¶
func NewEncoder(opt *EncoderOptions) Encoder
NewEncoder creates a new instance of Encoder, with a given config. A nil config will result in the default config beinng applied
type EncoderOptions ¶
type EncoderOptions struct { // The tag name used to find and encode struct fields TagName string // The function used for every input of this encoder. It is typically a composition of other functions EncodeHook EncodeHookFunc // Tells if the encoder should be silent or not when it finds an object it cannot decode Silent bool }
EncoderOptions represents the configuration applied to an encoder
type InputOtherType ¶
type InputOtherType interface { InputStruct // ConvertToInputObject directly converts the object as an input object? ConvertToInputObject() InputStruct }
InputOtherType represents a any complex type as an acceptable input for the manager queries.
type InputStruct ¶
type InputStruct interface { // ConvertToMap converts this input as a map of query inputs ConvertToMap() map[string]InputStruct }
InputStruct represents a struct as an acceptable input for the manager queries. It is also the most basic level of query input
func NewInputArray ¶
func NewInputArray(value []InputStruct) InputStruct
NewInputArray creates a primitiveInputObject from the golang type Array
func NewInputBool ¶
func NewInputBool(value *bool) InputStruct
NewInputBool creates a primitiveInputObject from the golang type Bool
func NewInputByteArray ¶
func NewInputByteArray(value []byte) InputStruct
NewInputByteArray creates a primitiveInputObject from the golang type []byte
func NewInputDateTime ¶
func NewInputDateTime(value *time.Time) InputStruct
NewInputDateTime creates a primitiveInputObject from the golang type Time
func NewInputFloat ¶
func NewInputFloat(value *float64) InputStruct
NewInputFloat creates a primitiveInputObject from the golang type Float
func NewInputInteger ¶
func NewInputInteger(value *int64) InputStruct
NewInputInteger creates a primitiveInputObject from the golang type Integer
func NewInputMap ¶
func NewInputMap(value map[string]InputStruct) InputStruct
NewInputMap creates a InputStruct from the golang type Map
func NewInputPoint ¶
func NewInputPoint(value *neo4j.Point) InputStruct
NewInputPoint creates a primitiveInputObject from the golang type neo4j.Point
func NewInputString ¶
func NewInputString(value *string) InputStruct
NewInputString creates a primitiveInputObject from the golang type String
func NewInputUnsignedInteger ¶
func NewInputUnsignedInteger(value *uint64) InputStruct
NewInputUnsignedInteger creates a primitiveInputObject from the golang type Unsigned Integer
type Manager ¶
type Manager interface { // IsConnected tells if the driver could effectively connect to the database IsConnected() bool // Query allows a single query to be made in database, possibly through an existing transaction Query(QueryParams) (QueryResult, Neo4GoError) // BeginTransaction starts a new transaction and stores it under the returned ID BeginTransaction(TransactionParams) (string, Neo4GoError) // Commit commits the transaction that has the given ID Commit(string) Neo4GoError // Rollback rolls back the transaction that has the given ID Rollback(string) Neo4GoError // LastBookmark returns the bookmark obtained by the session that ran the last query LastBookmark() string // Close closes the driver Close() Neo4GoError }
Manager is a wrapper around the neo4j-go-driver that simplifies its usage and adds type checking
type ManagerOptions ¶
type ManagerOptions struct { // The full URI to access the database (of the form protocol://domain:port) URI string // The name of the database to use DatabaseName string // The realm to use Realm string // The username to use for accessing the database with basic auth Username string // The password to use for accessing the database with basic auth Password string // The auth token used for any other kind of authentication than basic auth CustomAuth *neo4j.AuthToken // The neo4j configurers to apply to the driver Configurers []func(*neo4j.Config) // The default formatting to apply to every query of this manager DefaultOutputConfig queryOutputFlag }
ManagerOptions represents the configuration applied to a manager
type Neo4GoError ¶
type Neo4GoError interface { error // FmtError returns the formatted error with a prefix FmtError() string }
Neo4GoError is an error interface allowing to point out more precisely the error type
type QueryParams ¶
type QueryParams struct { // The cypher query to run in database Query string // The parameters to apply to this query Params map[string]InputStruct // The configurers to apply to the query Configurers []func(*neo4j.TransactionConfig) // The bookmarks of previous sessions to apply to the query Bookmarks []string // The transaction ID to use for the query Transaction string // Whether to commit the transaction (if there is one for this query) after the successfull execution of the query CommitOnSuccess bool // The different configurations to apply to the output of the query OutputConfig queryOutputFlag }
QueryParams represents all the configuration of a single query transaction
type QueryResult ¶
type QueryResult interface { // Keys returns the keys available on the result set. Keys() ([]string, Neo4GoError) // Next returns true only if there is a record to be processed. Next() bool // Err returns the latest error that caused this Next to return false. Err() Neo4GoError // Record returns the current typed record. Record() (*RecordMap, Neo4GoError) // Summary returns the summary information about the statement execution. Summary() (neo4j.ResultSummary, Neo4GoError) // Consume consumes the entire result and returns the summary information // about the statement execution. Consume() (neo4j.ResultSummary, Neo4GoError) // RawResult allow to retrieve the non-typed neo4j.Result RawResult() neo4j.Result }
QueryResult is the equivalent of neo4j.Result for neo4go manager queries
type RecordArray ¶
type RecordArray interface { // Next iterates to the next item of the array and return false if there are no more items Next() bool // Len returns the length of this array Len() int // CurrentAsArray returns the current item of the iteration typed as an Array. // The second result is a non-nil error if the current item cannot be converted as an Array. CurrentAsArray() (RecordArray, Neo4GoError) // CurrentAsMap returns the current item of the iteration typed as a Map. // The second result is a non-nil error if the current item cannot be converted as a Map. CurrentAsMap() (*RecordMap, Neo4GoError) // CurrentAsString returns the current item of the iteration typed as a String. // The second result is a non-nil error if the current item cannot be converted as a String. CurrentAsString() (*string, Neo4GoError) // CurrentAsInt returns the current item of the iteration typed as an Int. // The second result is a non-nil error if the current item cannot be converted as an Int. CurrentAsInt() (*int64, Neo4GoError) // CurrentAsFloat returns the current item of the iteration typed as a Float. // The second result is a non-nil error if the current item cannot be converted as a Float. CurrentAsFloat() (*float64, Neo4GoError) // CurrentAsBool returns the current item of the iteration typed as a Bool. // The second result is a non-nil error if the current item cannot be converted as a Bool. CurrentAsBool() (*bool, Neo4GoError) // CurrentAsTime returns the current item of the iteration typed as a Time. // The second result is a non-nil error if the current item cannot be converted as a Time. CurrentAsTime() (*time.Time, Neo4GoError) // CurrentAsNode returns the current item of the iteration typed as a Node. // The second result is a non-nil error if the current item cannot be converted as a Node. CurrentAsNode() (neo4j.Node, Neo4GoError) // CurrentAsRelation returns the current item of the iteration typed as a Relation. // The second result is a non-nil error if the current item cannot be converted as a Relation. CurrentAsRelation() (neo4j.Relationship, Neo4GoError) // CurrentAsPath returns the current item of the iteration typed as a Path. // The second result is a non-nil error if the current item cannot be converted as a Path. CurrentAsPath() (neo4j.Path, Neo4GoError) // CurrentAsInterface returns the current item of the iteration typed as an untyped Interface. CurrentAsInterface() interface{} // CollectAsArrays returns the whole array of this RecordArray typed as an Array of RecordArray. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as an Array. CollectAsArrays() ([]RecordArray, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of RecordMap. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a Map. CollectAsMaps() ([]RecordMap, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of string. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a string. CollectAsStrings() ([]string, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of int64. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as an int64. CollectAsInts() ([]int64, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of float. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a float. CollectAsFloats() ([]float64, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of bool. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a bool. CollectAsBools() ([]bool, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of time object. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a time.Time. CollectAsTimes() ([]time.Time, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of nodes. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a neo4j.Node. CollectAsNodes() ([]neo4j.Node, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of relationships. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a neo4j.Relationship. CollectAsRelations() ([]neo4j.Relationship, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of paths. // The second result is a non-nil error if at least one item of the RecordArray cannot be converted as a neo4j.Path. CollectAsPaths() ([]neo4j.Path, Neo4GoError) // CollectAsArrays returns the whole array of this RecordArray typed as an Array of interfaces. CollectAsInterfaces() []interface{} // CollectAndDecodeAsNodes collects all items of this array and converts them as nodes, then decodes them into the output interface CollectAndDecodeAsNodes(Decoder, interface{}) Neo4GoError // CollectAndDecodeAsRelations collects all items of this array and converts them as relationships, then decodes them into the output interface CollectAndDecodeAsRelations(Decoder, interface{}) Neo4GoError }
RecordMap contains all the typed objects retrieved from a neo4j array in a result. The items in the array can be iterated through via the Next function and retrieved as typed objects via the good function
func NewRecordArray ¶
func NewRecordArray(rawArray []interface{}, flags queryOutputFlag) RecordArray
NewRecordArray creates a new instance of RecordArray, with a given interface array.
type RecordMap ¶
type RecordMap struct { Arrays map[string]RecordArray Maps map[string]RecordMap Strings map[string]string Ints map[string]int64 Floats map[string]float64 Bools map[string]bool Times map[string]time.Time Durations map[string]time.Duration Nodes map[string]neo4j.Node Relations map[string]neo4j.Relationship Paths map[string]neo4j.Path Others map[string]interface{} // contains filtered or unexported fields }
RecordMap contains all the typed objects retrieved from a neo4j query result. Each object is in its typed map under the key attributed to it inside the cypher query
func (*RecordMap) DecodeNode ¶
func (rec *RecordMap) DecodeNode(decoder Decoder, nodeName string, outpout interface{}) Neo4GoError
DecodeNode is an utilitary function that automatically decodes a node from the record object
func (*RecordMap) DecodePath ¶
func (rec *RecordMap) DecodePath(decoder Decoder, pathName string, outputNode interface{}, outputRelation interface{}) Neo4GoError
DecodePath is an utilitary function that automatically decodes a path from the record object
func (*RecordMap) DecodeRelation ¶
func (rec *RecordMap) DecodeRelation(decoder Decoder, relationName string, outpout interface{}) Neo4GoError
DecodeRelation is an utilitary function that automatically decodes a relationship from the record object
type TransactionParams ¶
type TransactionParams struct { // Tells if the transaction type is read or write IsWrite bool // The bookmarks of previous sessions to apply to the query Bookmarks []string // The configurers to apply to the transaction Configurers []func(*neo4j.TransactionConfig) }
TransactionParams represents all the configuration of a single transaction at its creation