neoutils

package
v0.0.0-...-be403f1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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) 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) 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

func NewConstraintViolationError(message string, err *neoism.NeoError) error

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

type ConstraintViolationError struct {
	Msg string
	Err error
}

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 IndexEnsurer interface {
	EnsureConstraints(indexes map[string]string) error
	EnsureIndexes(indexes map[string]string) error
}

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) (NeoConnection, error)

type StringerDb

type StringerDb struct{ *neoism.Database }

StringerDb wraps neoism Database to provide a String function, which outputs the database URL

func (StringerDb) String

func (sdb StringerDb) String() string

type TransactionalCypherRunner

type TransactionalCypherRunner struct{ DB *neoism.Database }

func (TransactionalCypherRunner) CypherBatch

func (cr TransactionalCypherRunner) CypherBatch(queries []*neoism.CypherQuery) error

func (TransactionalCypherRunner) String

func (cr TransactionalCypherRunner) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL