neo4jdriver

package
v2.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MsgHealthy = "Neo4j is healthy"

MsgHealthy Check message returned when Neo4j is healthy

View Source
const ServiceName = "neo4j"

ServiceName : neo4j

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltConn

type BoltConn bolt.Conn

type BoltRowReader

type BoltRowReader struct {
	// contains filtered or unexported fields
}

BoltRowReader translates Neo4j rows to CSV rows.

func NewBoltRowReader

func NewBoltRowReader(rows bolt.Rows, conn bolt.Conn) *BoltRowReader

NewBoltRowReader returns a new reader instace for the given bolt rows.

func (*BoltRowReader) Close

func (reader *BoltRowReader) Close(ctx context.Context) error

Close the contained rows and database connection

func (*BoltRowReader) Read

func (reader *BoltRowReader) Read() (string, error)

Read the next row, or return io.EOF

type BoltRows

type BoltRows bolt.Rows

type ClosableDriverPool

type ClosableDriverPool interface {
	// OpenPool opens a Neo-specific connection.
	OpenPool() (bolt.Conn, error)
	Close() error
}

ClosableDriverPool corresponds to the interface bolt.ClosableDriverPool with only the exported fields and methods TODO we might want to modify bolt.ClosableDriverPool with exported fields/methods only and remove this interface I.e. remove reclaim(*boltConn) from driverPool interface in bolt.driver.

type Neo4jDriver

type Neo4jDriver interface {
	Count(query string) (count int64, err error)
	Exec(query string, params map[string]interface{}) (bolt.Result, error)
	Read(query string, mapp mapper.ResultMapper, single bool) error
	ReadWithParams(query string, params map[string]interface{}, mapp mapper.ResultMapper, single bool) error
	StreamRows(query string) (*BoltRowReader, error)

	driver.Driver
}

Neo4jDriver is the interface that wraps basic neo4j driver functionality

type NeoDriver

type NeoDriver struct {
	// contains filtered or unexported fields
}

NeoDriver contains a connection pool and allows basic interaction with the database

func New

func New(dbAddr string, size, timeout int) (n *NeoDriver, err error)

New neo4j closeable connection pool configured with the provided address, connection pool size and timeout

func NewWithPool

func NewWithPool(pool ClosableDriverPool) (n *NeoDriver)

NewWithPool : New NeoDriver structure containing the pool passed as parameter and a new Check

func (*NeoDriver) Checker

func (n *NeoDriver) Checker(ctx context.Context, state *health.CheckState) error

Checker hecks health of Neo4j and updates the provided CheckState accordingly

func (*NeoDriver) Close

func (n *NeoDriver) Close(ctx context.Context) error

Close the contained connection pool

func (*NeoDriver) Count

func (n *NeoDriver) Count(query string) (count int64, err error)

Count nodes returned by the provided query

func (*NeoDriver) Exec

func (n *NeoDriver) Exec(query string, params map[string]interface{}) (bolt.Result, error)

Exec executes the provided query with relevant parameters and returns the response directly

func (*NeoDriver) Healthcheck

func (n *NeoDriver) Healthcheck() (string, error)

Healthcheck calls neo4j to check its health status.

func (*NeoDriver) Read

func (n *NeoDriver) Read(query string, mapp mapper.ResultMapper, single bool) error

ReadWithParams takes a query and an indicator of whether a single or list response is expected and writes results into the ResultMapper provided

func (*NeoDriver) ReadWithParams

func (n *NeoDriver) ReadWithParams(query string, params map[string]interface{}, mapp mapper.ResultMapper, single bool) error

ReadWithParams takes a query, a map of parameters and an indicator of whether a single or list response is expected and writes results into the ResultMapper provided

func (*NeoDriver) StreamRows

func (n *NeoDriver) StreamRows(query string) (*BoltRowReader, error)

StreamRows according to provided query into a Reader and return the Reader and any errors. The Reader will contain reference to the database connection and must be closed by the caller.

type Result

type Result bolt.Result

Result of queries to neo4j - needed for mocking and tests

Jump to

Keyboard shortcuts

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