Documentation
¶
Index ¶
- func ConvertNode(node neo4j.Node, candidate interface{}, otherCandidates ...interface{}) (interface{}, error)
- type Config
- type Connection
- func (s *Connection) Close()
- func (con *Connection) CreateNode(value interface{}) (int64, neo4j.Result, error)
- func (con *Connection) DeleteByID(id int64) error
- func (con *Connection) DeleteNode(node interface{}) error
- func (con *Connection) Execute(cypher string, params map[string]interface{}) error
- func (con *Connection) FindAllNodes(nodeType interface{}) ([]interface{}, error)
- func (con *Connection) FindById(id int64, candidate interface{}) (interface{}, error)
- func (con *Connection) FindByProperty(property string, value string, candidate []interface{}) ([]interface{}, error)
- func (con *Connection) FindNodesClause(nodeType interface{}, where map[string]interface{}, mode SearchMode) ([]interface{}, error)
- func (con *Connection) GetSession() neo4j.Session
- func (con *Connection) InTransaction(f func(con *Connection) ([]neo4j.Result, error)) error
- func (con *Connection) MatchRelation(name string, candidate interface{}, otherCandidate ...interface{}) ([]Relation, error)
- func (con *Connection) RelationByNodeID(id int64, candidate interface{}, otherCandidate ...interface{}) ([]Relation, error)
- func (con *Connection) SetSession(neoSession neo4j.Session)
- func (con *Connection) SetUniqueConstraint(label interface{}, field string, constraintName string) error
- type DB
- type DefaultConfig
- type Model
- type Relation
- type SearchMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertNode ¶
func ConvertNode(node neo4j.Node, candidate interface{}, otherCandidates ...interface{}) (interface{}, error)
ConvertNode converts neo4j node into one of the candidate struct
Types ¶
type Config ¶
type Config interface {
GetHost() string
GetPort() int
GetUser() string
GetPassword() string
GetEncrypted() bool
}
Config ...
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Close ¶
func (s *Connection) Close()
func (*Connection) CreateNode ¶
func (con *Connection) CreateNode(value interface{}) (int64, neo4j.Result, error)
CreateNode ... returns: - id of the created node - neo4j.Result to be consumed when in a transaction - error
func (*Connection) DeleteByID ¶ added in v0.0.7
func (con *Connection) DeleteByID(id int64) error
DeleteByID delete any node by ID
func (*Connection) DeleteNode ¶ added in v0.0.6
func (con *Connection) DeleteNode(node interface{}) error
DeleteNode ...
func (*Connection) Execute ¶
func (con *Connection) Execute(cypher string, params map[string]interface{}) error
Execute a cypher
func (*Connection) FindAllNodes ¶
func (con *Connection) FindAllNodes(nodeType interface{}) ([]interface{}, error)
FindAllNodes finds all nodes of a given type
func (*Connection) FindById ¶ added in v0.0.8
func (con *Connection) FindById(id int64, candidate interface{}) (interface{}, error)
func (*Connection) FindByProperty ¶ added in v0.0.4
func (con *Connection) FindByProperty(property string, value string, candidate []interface{}) ([]interface{}, error)
FindByProperty find all node with given property containg value
func (*Connection) FindNodesClause ¶
func (con *Connection) FindNodesClause(nodeType interface{}, where map[string]interface{}, mode SearchMode) ([]interface{}, error)
FindNodesClause finds all nodes of a given type searchMode is applied for all string
func (*Connection) GetSession ¶
func (con *Connection) GetSession() neo4j.Session
func (*Connection) InTransaction ¶
func (con *Connection) InTransaction(f func(con *Connection) ([]neo4j.Result, error)) error
InTransaction ... execute given function in a transaction
func (*Connection) MatchRelation ¶
func (con *Connection) MatchRelation(name string, candidate interface{}, otherCandidate ...interface{}) ([]Relation, error)
MatchRelation ...
func (*Connection) RelationByNodeID ¶ added in v0.0.4
func (con *Connection) RelationByNodeID(id int64, candidate interface{}, otherCandidate ...interface{}) ([]Relation, error)
RelationByNodeID return all relations for a given node id
func (*Connection) SetSession ¶
func (con *Connection) SetSession(neoSession neo4j.Session)
func (*Connection) SetUniqueConstraint ¶ added in v0.0.4
func (con *Connection) SetUniqueConstraint(label interface{}, field string, constraintName string) error
SetUniqueConstraint ...
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) GetConnection ¶
func (db *DB) GetConnection() (Connection, error)
GetConnection open and return a neo4j session
type DefaultConfig ¶
type DefaultConfig struct {
// contains filtered or unexported fields
}
DefaultConfig for testing
type Model ¶
type Model struct {
ID int64 `json:"id"` // neo4j node or relationship ID
Labels map[string]string `json:"attribute,omitempty"` // any label not defined mapping struct
}
Model go struct to add neo4j specific fields
type Relation ¶
type Relation struct {
Relation string
From interface{}
To interface{}
}
Relation ...
type SearchMode ¶
type SearchMode int
SearchMode operation used for `WHERE` clauses
const ( Exact SearchMode = 1 + iota StartsWith Contains EndsWith Regexp IgnoreCase )