Documentation ¶
Index ¶
- func Check(cr CypherRunner) error
- func CheckWritable(cr CypherRunner) error
- func EnsureConstraints(im IndexManager, indexes map[string]string, log *logger.UPPLogger) error
- func EnsureIndexes(im IndexManager, indexes map[string]string, log *logger.UPPLogger) error
- func NewConstraintViolationError(message string, err *neoism.NeoError) error
- func UnderlyingDB(con NeoConnection) *neoism.Database
- type AutoConnectTransactional
- func (a *AutoConnectTransactional) CypherBatch(queries []*neoism.CypherQuery) error
- func (a *AutoConnectTransactional) EnsureConstraints(constraints map[string]string) error
- func (a *AutoConnectTransactional) EnsureIndexes(indexes map[string]string) error
- func (a *AutoConnectTransactional) String() string
- type BatchCypherRunner
- type ConnectionConfig
- type ConstraintViolationError
- type CypherRunner
- type DefaultNeoConnection
- type IndexEnsurer
- type IndexManager
- type NeoConnection
- type StringerDb
- type TransactionalCypherRunner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
func Check(cr CypherRunner) error
Check will use the supplied CypherRunner to check connectivity to Neo4j
func CheckWritable ¶
func CheckWritable(cr CypherRunner) error
CheckWritable calls the dbms.cluster.role() procedure and verifies the role if it's LEADER or not.
func EnsureConstraints ¶
func EnsureConstraints(im IndexManager, indexes map[string]string, log *logger.UPPLogger) error
EnsureConstraints will, for a map of labels and properties, check whether a constraint exists for a given property on a given label, and if missing will create one. Creating the unique constraint ensures an index automatically.
func EnsureIndexes ¶
func EnsureIndexes(im IndexManager, indexes map[string]string, log *logger.UPPLogger) error
EnsureIndexes will, for a map of labels and properties, check whether an index exists for a given property on a given label, and if missing will create one.
func NewConstraintViolationError ¶
NewConstraintViolationError returns, as an error, a new NewConstraintViolationError with the given message and error details. As a convenience, if err is nil, NewSyscallError returns nil.
func UnderlyingDB ¶
func UnderlyingDB(con NeoConnection) *neoism.Database
Types ¶
type AutoConnectTransactional ¶
type AutoConnectTransactional struct {
// contains filtered or unexported fields
}
func (*AutoConnectTransactional) CypherBatch ¶
func (a *AutoConnectTransactional) CypherBatch(queries []*neoism.CypherQuery) error
func (*AutoConnectTransactional) EnsureConstraints ¶
func (a *AutoConnectTransactional) EnsureConstraints(constraints map[string]string) error
func (*AutoConnectTransactional) EnsureIndexes ¶
func (a *AutoConnectTransactional) EnsureIndexes(indexes map[string]string) error
func (*AutoConnectTransactional) String ¶
func (a *AutoConnectTransactional) String() string
type BatchCypherRunner ¶
type BatchCypherRunner struct {
// contains filtered or unexported fields
}
func (*BatchCypherRunner) CypherBatch ¶
func (bcr *BatchCypherRunner) CypherBatch(queries []*neoism.CypherQuery) error
type ConnectionConfig ¶
type ConnectionConfig struct { // BatchSize controls how and whether to batch multiple requests to // CypherQuery into a single batch. BatchSize 0 disables this behaviour. // Values >0 indicate the largest preferred batch size. Actual sizes // may be larger because values from a single call will never be split. BatchSize int // Transactional indicates that the connection should use the // transactional endpoints in the neo4j REST API. Transactional bool // Optionally a custom http.Client can be supplied HTTPClient *http.Client // BackgroundConnect indicates that NeoConnection should be available when // neo4j is not available, and will connect and re-connect as required. BackgroundConnect bool }
func DefaultConnectionConfig ¶
func DefaultConnectionConfig() *ConnectionConfig
type ConstraintViolationError ¶
ConstraintViolationError is a possible error the Service can return
func (*ConstraintViolationError) Error ¶
func (err *ConstraintViolationError) Error() string
type CypherRunner ¶
type CypherRunner interface {
CypherBatch(queries []*neoism.CypherQuery) error
}
func NewBatchCypherRunner ¶
func NewBatchCypherRunner(cypherRunner CypherRunner, count int) CypherRunner
type DefaultNeoConnection ¶
type DefaultNeoConnection struct {
// contains filtered or unexported fields
}
func (*DefaultNeoConnection) CypherBatch ¶
func (c *DefaultNeoConnection) CypherBatch(cypher []*neoism.CypherQuery) error
func (*DefaultNeoConnection) EnsureConstraints ¶
func (c *DefaultNeoConnection) EnsureConstraints(constraints map[string]string) error
func (*DefaultNeoConnection) EnsureIndexes ¶
func (c *DefaultNeoConnection) EnsureIndexes(indexes map[string]string) error
func (*DefaultNeoConnection) String ¶
func (c *DefaultNeoConnection) String() string
type IndexEnsurer ¶
type IndexManager ¶
type IndexManager interface { CreateIndex(label string, propertyName string) (*neoism.Index, error) Indexes(label string) ([]*neoism.Index, error) CreateUniqueConstraint(label string, propertyName string) (*neoism.UniqueConstraint, error) UniqueConstraints(label string, propertyName string) ([]*neoism.UniqueConstraint, error) }
IndexManager manages the maintenance of indexes and unique constraints
type NeoConnection ¶
type NeoConnection interface { CypherRunner IndexEnsurer }
func Connect ¶
func Connect(neoURL string, conf *ConnectionConfig, log *logger.UPPLogger) (NeoConnection, error)
This is the entrypoint for the services trying to connect to Neo4j, where neoURL - the path to Neo4j, conf - the configuration required for logging to Neo4j, log - an optional parameter for logging messages. If not provided, we initialize an object of the type go-logger v2
type StringerDb ¶
StringerDb wraps neoism Database to provide a String function, which outputs the database URL
func (StringerDb) String ¶
func (sdb StringerDb) String() string
type TransactionalCypherRunner ¶
func (TransactionalCypherRunner) CypherBatch ¶
func (cr TransactionalCypherRunner) CypherBatch(queries []*neoism.CypherQuery) error
func (TransactionalCypherRunner) String ¶
func (cr TransactionalCypherRunner) String() string