neo4j

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 23 Imported by: 137

Documentation

Overview

Package neo4j provides required functionality to connect and execute statements against a Neo4j Database.

Index

Constants

View Source
const (
	// ERROR is the level that error messages are written
	ERROR LogLevel = 1
	// WARNING is the level that warning messages are written
	WARNING = 2
	// INFO is the level that info messages are written
	INFO = 3
	// DEBUG is the level that debug messages are written
	DEBUG = 4
)

Variables

This section is empty.

Functions

func IsAuthenticationError

func IsAuthenticationError(err error) bool

IsAuthenticationError is a utility method to check if the provided error is related with any authentication issues.

func IsClientError

func IsClientError(err error) bool

IsClientError is a utility method to check if the provided error is related with the client carrying out an invalid operation.

func IsSecurityError

func IsSecurityError(err error) bool

IsSecurityError is a utility method to check if the provided error is related with any TLS failure or authentication issues.

func IsServiceUnavailable

func IsServiceUnavailable(err error) bool

IsServiceUnavailable is a utility method to check if the provided error can be classified to be in service unavailable category.

func IsSessionExpired

func IsSessionExpired(err error) bool

IsSessionExpired is a utility method to check if the session no longer satisfy the criteria under which it was acquired, e.g. a server no longer accepts write requests.

func IsTransientError

func IsTransientError(err error) bool

IsTransientError is a utility method to check if the provided error is related with a temporary failure that may be worked around by retrying.

func WithTxMetadata

func WithTxMetadata(metadata map[string]interface{}) func(*TransactionConfig)

WithTxMetadata returns a transaction configuration function that attaches metadata to a transaction.

To attach a metadata to an explicit transaction:

session.BeginTransaction(WithTxMetadata(map[string)interface{}{"work-id": 1}))

To attach a metadata to an auto-commit transaction:

session.Run("RETURN 1", nil, WithTxMetadata(map[string)interface{}{"work-id": 1}))

To attach a metadata to a read transaction function:

session.ReadTransaction(DoWork, WithTxMetadata(map[string)interface{}{"work-id": 1}))

To attach a metadata to a write transaction function:

session.WriteTransaction(DoWork, WithTxMetadata(map[string)interface{}{"work-id": 1}))

func WithTxTimeout

func WithTxTimeout(timeout time.Duration) func(*TransactionConfig)

WithTxTimeout returns a transaction configuration function that applies a timeout to a transaction.

To apply a transaction timeout to an explicit transaction:

session.BeginTransaction(WithTxTimeout(5*time.Seconds))

To apply a transaction timeout to an auto-commit transaction:

session.Run("RETURN 1", nil, WithTxTimeout(5*time.Seconds))

To apply a transaction timeout to a read transaction function:

session.ReadTransaction(DoWork, WithTxTimeout(5*time.Seconds))

To apply a transaction timeout to a write transaction function:

session.WriteTransaction(DoWork, WithTxTimeout(5*time.Seconds))

Types

type AccessMode

type AccessMode int

AccessMode defines modes that routing driver decides to which cluster member a connection should be opened.

const (
	// AccessModeWrite tells the driver to use a connection to 'Leader'
	AccessModeWrite AccessMode = 0
	// AccessModeRead tells the driver to use a connection to one of the 'Follower' or 'Read Replica'.
	AccessModeRead AccessMode = 1
)

type AuthToken

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

AuthToken contains credentials to be sent over to the neo4j server.

func BasicAuth

func BasicAuth(username string, password string, realm string) AuthToken

BasicAuth generates a basic authentication token with provided username, password and realm

func CustomAuth

func CustomAuth(scheme string, username string, password string, realm string, parameters map[string]interface{}) AuthToken

CustomAuth generates a custom authentication token with provided parameters

func KerberosAuth

func KerberosAuth(ticket string) AuthToken

KerberosAuth generates a kerberos authentication token with provided base-64 encoded kerberos ticket

func NoAuth

func NoAuth() AuthToken

NoAuth generates an empty authentication token

type Config

type Config struct {
	// Whether to turn on/off TLS encryption.
	//
	// default: true
	Encrypted bool
	// Sets how the driver establishes trust with the Neo4j instance
	// it is connected to.
	//
	// default: TrustAny(false)
	TrustStrategy TrustStrategy
	// Logging target the driver will send its log outputs
	//
	// default: No Op Logger
	Log Logging
	// Resolver that would be used to resolve initial router address. This may
	// be useful if you want to provide more than one URL for initial router.
	// If not specified, the provided bolt+routing URL is used as the initial
	// router.
	//
	// default: nil
	AddressResolver ServerAddressResolver
	// Maximum amount of time a retriable operation would continue retrying. It
	// cannot be specified as a negative value.
	//
	// default: 30 * time.Second
	MaxTransactionRetryTime time.Duration
	// Maximum number of connections per URL to allow on this driver. It
	// cannot be specified as 0 and negative values are interpreted as
	// math.MaxInt32.
	//
	// default: 100
	MaxConnectionPoolSize int
	// Maximum connection life time on pooled connections. Values less than
	// or equal to 0 disables the lifetime check.
	//
	// default: 1 * time.Hour
	MaxConnectionLifetime time.Duration
	// Maximum amount of time to either acquire an idle connection from the pool
	// or create a new connection (when the pool is not full). Negative values
	// result in an infinite wait time where 0 value results in no timeout which
	// results in immediate failure when there are no available connections.
	//
	// default: 1 * time.Minute
	ConnectionAcquisitionTimeout time.Duration
	// Connect timeout that will be set on underlying sockets. Values less than
	// or equal to 0 results in no timeout being applied.
	//
	// default: 5 * time.Second
	SocketConnectTimeout time.Duration
	// Whether to enable TCP keep alive on underlying sockets.
	//
	// default: true
	SocketKeepalive bool
}

A Config contains options that can be used to customize certain aspects of the driver

type Counters

type Counters interface {
	// Whether there were any updates at all, eg. any of the counters are greater than 0.
	ContainsUpdates() bool
	// The number of nodes created.
	NodesCreated() int
	// The number of nodes deleted.
	NodesDeleted() int
	// The number of relationships created.
	RelationshipsCreated() int
	// The number of relationships deleted.
	RelationshipsDeleted() int
	PropertiesSet() int
	// The number of labels added to nodes.
	LabelsAdded() int
	// The number of labels removed from nodes.
	LabelsRemoved() int
	// The number of indexes added to the schema.
	IndexesAdded() int
	// The number of indexes removed from the schema.
	IndexesRemoved() int
	// The number of constraints added to the schema.
	ConstraintsAdded() int
	// The number of constraints removed from the schema.
	ConstraintsRemoved() int
}

Counters contains statistics about the changes made to the database made as part of the statement execution.

type Date

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

Date represents a date value, without a time zone and time related components.

func DateOf

func DateOf(of time.Time) Date

DateOf creates a local date from the provided instant by extracting year, month and day fields.

func (Date) Day

func (date Date) Day() int

Day returns the day component of this instance.

func (Date) Month

func (date Date) Month() time.Month

Month returns the month component of this instance.

func (Date) String

func (date Date) String() string

String returns the string representation of this Date in ISO-8601 compliant form.

func (Date) Time

func (date Date) Time() time.Time

Time converts the local date to a time instant with fields other than year, month and day set to 0. Returned time's location is time.UTC.

func (Date) Year

func (date Date) Year() int

Year returns the year component of this instance.

type Driver

type Driver interface {
	// The url this driver is bootstrapped
	Target() url.URL
	Session(accessMode AccessMode, bookmarks ...string) (Session, error)
	// Creates a new session based on the specified session configuration.
	// The session configuration contains access mode, bookmarks and database name.
	NewSession(config SessionConfig) (Session, error)
	// Close the driver and all underlying connections
	Close() error
}

Driver represents a pool(s) of connections to a neo4j server or cluster. It's safe for concurrent use.

func NewDriver

func NewDriver(target string, auth AuthToken, configurers ...func(*Config)) (Driver, error)

NewDriver is the entry point to the neo4j driver to create an instance of a Driver. It is the first function to be called in order to establish a connection to a neo4j database. It requires a Bolt URI and an authentication token as parameters and can also take optional configuration function(s) as variadic parameters.

In order to connect to a single instance database, you need to pass a URI with scheme 'bolt'

driver, err = NewDriver("bolt://db.server:7687", BasicAuth(username, password))

In order to connect to a causal cluster database, you need to pass a URI with scheme 'bolt+routing' or 'neo4j' and its host part set to be one of the core cluster members. Please note that 'bolt+routing' scheme will be removed with 2.0 series of drivers.

driver, err = NewDriver("bolt+routing://core.db.server:7687", BasicAuth(username, password))

You can override default configuration options by providing a configuration function(s)

driver, err = NewDriver(uri, BasicAuth(username, password), function (config *Config) {
	config.MaxConnectionPoolSize = 10
})

type Duration

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

Duration represents temporal amount containing months, days, seconds and nanoseconds.

func DurationOf

func DurationOf(months int64, days int64, seconds int64, nanos int) Duration

DurationOf creates a Duration with provided temporal fields.

func (Duration) Days

func (duration Duration) Days() int64

Days returns the number of days in this duration.

func (Duration) Months

func (duration Duration) Months() int64

Months returns the number of months in this duration.

func (Duration) Nanos

func (duration Duration) Nanos() int

Nanos returns the number of nanoseconds in this duration.

func (Duration) Seconds

func (duration Duration) Seconds() int64

Seconds returns the number of seconds in this duration.

func (Duration) String

func (duration Duration) String() string

String returns the string representation of this Duration in ISO-8601 compliant form.

type InputPosition

type InputPosition interface {
	// Offset returns the character offset referred to by this position; offset numbers start at 0.
	Offset() int
	// Line returns the line number referred to by this position; line numbers start at 1.
	Line() int
	// Column returns the column number referred to by this position; column numbers start at 1.
	Column() int
}

InputPosition contains information about a specific position in a statement

type LocalDateTime

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

LocalDateTime represents a local date time value, without a time zone.

func LocalDateTimeOf

func LocalDateTimeOf(of time.Time) LocalDateTime

LocalDateTimeOf creates an local date time from the provided instant by extracting its temporal fields.

func (LocalDateTime) Day

func (localDateTime LocalDateTime) Day() int

Day returns the day component of this instance.

func (LocalDateTime) Hour

func (localDateTime LocalDateTime) Hour() int

Hour returns the hour component of this instance.

func (LocalDateTime) Minute

func (localDateTime LocalDateTime) Minute() int

Minute returns the minute component of this instance.

func (LocalDateTime) Month

func (localDateTime LocalDateTime) Month() time.Month

Month returns the month component of this instance.

func (LocalDateTime) Nanosecond

func (localDateTime LocalDateTime) Nanosecond() int

Nanosecond returns the nanosecond component of this instance.

func (LocalDateTime) Second

func (localDateTime LocalDateTime) Second() int

Second returns the second component of this instance.

func (LocalDateTime) String

func (localDateTime LocalDateTime) String() string

String returns the string representation of this LocalDateTime in ISO-8601 compliant form.

func (LocalDateTime) Time

func (localDateTime LocalDateTime) Time() time.Time

Time converts the local date time to a corresponding time instant. Returned time's location is time.UTC.

func (LocalDateTime) Year

func (localDateTime LocalDateTime) Year() int

Year returns the year component of this instance.

type LocalTime

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

LocalTime represents a local time value.

func LocalTimeOf

func LocalTimeOf(of time.Time) LocalTime

LocalTimeOf creates a local time from the provided instant by extracting hour, minute, second and nanosecond fields.

func (LocalTime) Hour

func (localTime LocalTime) Hour() int

Hour returns the hour component of this instance.

func (LocalTime) Minute

func (localTime LocalTime) Minute() int

Minute returns the minute component of this instance.

func (LocalTime) Nanosecond

func (localTime LocalTime) Nanosecond() int

Nanosecond returns the nanosecond component of this instance.

func (LocalTime) Second

func (localTime LocalTime) Second() int

Second returns the second component of this instance.

func (LocalTime) String

func (localTime LocalTime) String() string

String returns the string representation of this LocalTime in ISO-8601 compliant form.

func (LocalTime) Time

func (localTime LocalTime) Time() time.Time

Time converts the local time to a time instant with fields other than hour, minute, second and nanosecond set to 0. Returned time's location is time.Local.

type LogLevel

type LogLevel int

LogLevel is the type that default logging implementations use for available log levels

type Logging

type Logging interface {
	ErrorEnabled() bool
	WarningEnabled() bool
	InfoEnabled() bool
	DebugEnabled() bool

	Errorf(message string, args ...interface{})
	Warningf(message string, args ...interface{})
	Infof(message string, args ...interface{})
	Debugf(message string, args ...interface{})
}

Logging is the interface that any provided logging target must satisfy for the neo4j driver to send its logging messages

func ConsoleLogger

func ConsoleLogger(level LogLevel) Logging

ConsoleLogger returns a simple logger that writes its messages to the console

func NoOpLogger

func NoOpLogger() Logging

NoOpLogger returns a logger that doesn't generate any output at all

type Node

type Node interface {
	// Id returns the identity of this Node.
	Id() int64
	// Labels returns the labels attached to this Node.
	Labels() []string
	// Props returns the properties of this Node.
	Props() map[string]interface{}
}

Node represents a node in the neo4j graph database

type Notification

type Notification interface {
	// Code returns a notification code for the discovered issue of this notification.
	Code() string
	// Title returns a short summary of this notification.
	Title() string
	// Description returns a longer description of this notification.
	Description() string
	// Position returns the position in the statement where this notification points to.
	// Not all notifications have a unique position to point to and in that case the position would be set to nil.
	Position() InputPosition
	// Severity returns the severity level of this notification.
	Severity() string
}

Notification represents notifications generated when executing a statement. A notification can be visualized in a client pinpointing problems or other information about the statement.

type OffsetTime

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

OffsetTime represents a time value with a UTC offset.

func OffsetTimeOf

func OffsetTimeOf(of time.Time) OffsetTime

OffsetTimeOf creates an offset time from the provided instant by extracting hour, minute, second and nanosecond fields and it's zone offset.

func (OffsetTime) Hour

func (offsetTime OffsetTime) Hour() int

Hour returns the hour component of this instance.

func (OffsetTime) Minute

func (offsetTime OffsetTime) Minute() int

Minute returns the minute component of this instance.

func (OffsetTime) Nanosecond

func (offsetTime OffsetTime) Nanosecond() int

Nanosecond returns the nanosecond component of this instance.

func (OffsetTime) Offset

func (offsetTime OffsetTime) Offset() int

Offset returns the offset of this instance in seconds.

func (OffsetTime) Second

func (offsetTime OffsetTime) Second() int

Second returns the second component of this instance.

func (OffsetTime) String

func (offsetTime OffsetTime) String() string

String returns the string representation of this OffsetTime in ISO-8601 compliant form.

func (OffsetTime) Time

func (offsetTime OffsetTime) Time() time.Time

Time converts the offset time to a time instant with fields other than hour, minute, second and nanosecond set to 0. Returned time's location is a fixed zone with name 'Offset' and corresponding offset value.

type Path

type Path interface {
	// Nodes returns all the nodes in the path.
	Nodes() []Node
	// Relationships returns all the relationships in the path.
	Relationships() []Relationship
}

Path represents a directed sequence of relationships between two nodes. This generally represents a traversal or walk through a graph and maintains a direction separate from that of any relationships traversed. It is allowed to be of size 0, meaning there are no relationships in it. In this case, it contains only a single node which is both the start and the end of the path.

type Plan

type Plan interface {
	// Operator returns the operation this plan is performing.
	Operator() string
	// Arguments returns the arguments for the operator used.
	// Many operators have arguments defining their specific behavior. This map contains those arguments.
	Arguments() map[string]interface{}
	// Identifiers returns a list of identifiers used by this plan. Identifiers used by this part of the plan.
	// These can be both identifiers introduced by you, or automatically generated.
	Identifiers() []string
	// Children returns zero or more child plans. A plan is a tree, where each child is another plan.
	// The children are where this part of the plan gets its input records - unless this is an operator that
	// introduces new records on its own.
	Children() []Plan
}

Plan describes the actual plan that the database planner produced and used (or will use) to execute your statement. This can be extremely helpful in understanding what a statement is doing, and how to optimize it. For more details, see the Neo4j Manual. The plan for the statement is a tree of plans - each sub-tree containing zero or more child plans. The statement starts with the root plan. Each sub-plan is of a specific operator, which describes what that part of the plan does - for instance, perform an index lookup or filter results. The Neo4j Manual contains a reference of the available operator types, and these may differ across Neo4j versions.

type Point

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

Point represents a single two or three dimensional point in a particular coordinate reference system.

func NewPoint2D

func NewPoint2D(srId int, x float64, y float64) *Point

NewPoint2D creates a two dimensional Point with provided coordinates and coordinate reference system.

func NewPoint3D

func NewPoint3D(srId int, x float64, y float64, z float64) *Point

NewPoint3D creates a three dimensional Point with provided coordinates and coordinate reference system.

func (*Point) SrId

func (point *Point) SrId() int

SrId returns the Point's coordinate reference system.

func (*Point) String

func (point *Point) String() string

String returns the string representation of this Point.

func (*Point) X

func (point *Point) X() float64

X returns the Point's X coordinate.

func (*Point) Y

func (point *Point) Y() float64

Y returns the Point's Y coordinate.

func (*Point) Z

func (point *Point) Z() float64

Z returns the Point's Z coordinate. math.NaN is returned when the Point is two dimensional.

type ProfiledPlan

type ProfiledPlan interface {
	// Operator returns the operation this plan is performing.
	Operator() string
	// Arguments returns the arguments for the operator used.
	// Many operators have arguments defining their specific behavior. This map contains those arguments.
	Arguments() map[string]interface{}
	// Identifiers returns a list of identifiers used by this plan. Identifiers used by this part of the plan.
	// These can be both identifiers introduced by you, or automatically generated.
	Identifiers() []string
	// DbHits returns the number of times this part of the plan touched the underlying data stores/
	DbHits() int64
	// Records returns the number of records this part of the plan produced.
	Records() int64
	// Children returns zero or more child plans. A plan is a tree, where each child is another plan.
	// The children are where this part of the plan gets its input records - unless this is an operator that
	// introduces new records on its own.
	Children() []ProfiledPlan
}

ProfiledPlan is the same as a regular Plan - except this plan has been executed, meaning it also contains detailed information about how much work each step of the plan incurred on the database.

type Record

type Record interface {
	// Keys returns the keys available
	Keys() []string
	// Values returns the values
	Values() []interface{}
	// Get returns the value (if any) corresponding to the given key
	Get(key string) (interface{}, bool)
	// GetByIndex returns the value at given index
	GetByIndex(index int) interface{}
}

func Collect

func Collect(from interface{}, err error) ([]Record, error)

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.

func Single

func Single(from interface{}, err error) (Record, error)

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.

type Relationship

type Relationship interface {
	// Id returns the identity of this Relationship.
	Id() int64
	// StartId returns the identity of the start node of this Relationship.
	StartId() int64
	// EndId returns the identity of the end node of this Relationship.
	EndId() int64
	// Type returns the type of this Relationship.
	Type() string
	// Props returns the properties of this Relationship.
	Props() map[string]interface{}
}

Relationship represents a relationship in the neo4j graph database

type Result

type Result interface {
	// Keys returns the keys available on the result set.
	Keys() ([]string, error)
	// 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() error
	// Record returns the current record.
	Record() Record
	// Summary returns the summary information about the statement execution.
	Summary() (ResultSummary, error)
	// Consume consumes the entire result and returns the summary information
	// about the statement execution.
	Consume() (ResultSummary, error)
}

type ResultSummary

type ResultSummary interface {
	// Server returns basic information about the server where the statement is carried out.
	Server() ServerInfo
	// Statement returns statement that has been executed.
	Statement() Statement
	// StatementType returns type of statement that has been executed.
	StatementType() StatementType
	// Counters returns statistics counts for the statement.
	Counters() Counters
	// Plan returns statement plan for the executed statement if available, otherwise null.
	Plan() Plan
	// Profile returns profiled statement plan for the executed statement if available, otherwise null.
	Profile() ProfiledPlan
	// Notifications returns a slice of notifications produced while executing the statement.
	// The list will be empty if no notifications produced while executing the statement.
	Notifications() []Notification
	// ResultAvailableAfter returns the time it took for the server to make the result available for consumption.
	ResultAvailableAfter() time.Duration
	// ResultConsumedAfter returns the time it took the server to consume the result.
	ResultConsumedAfter() time.Duration
}

type ServerAddress

type ServerAddress interface {
	// Hostname returns the host portion of this ServerAddress.
	Hostname() string
	// Port returns the port portion of this ServerAddress.
	Port() string
}

ServerAddress represents a host and port. Host can either be an IP address or a DNS name. Both IPv4 and IPv6 hosts are supported.

func NewServerAddress

func NewServerAddress(hostname string, port string) ServerAddress

NewServerAddress generates a ServerAddress with provided hostname and port information.

type ServerAddressResolver

type ServerAddressResolver func(address ServerAddress) []ServerAddress

ServerAddressResolver is a function type that defines the resolver function used by the routing driver to resolve the initial address used to create the driver.

type ServerInfo

type ServerInfo interface {
	// Address returns the address of the server.
	Address() string
	// Version returns the version of Neo4j running at the server.
	Version() string
}

ServerInfo contains basic information of the server.

type Session

type Session interface {
	// LastBookmark returns the bookmark received following the last successfully completed transaction.
	// If no bookmark was received or if this transaction was rolled back, the bookmark value will not be changed.
	LastBookmark() string
	// BeginTransaction starts a new explicit transaction on this session
	BeginTransaction(configurers ...func(*TransactionConfig)) (Transaction, error)
	// ReadTransaction executes the given unit of work in a AccessModeRead transaction with
	// retry logic in place
	ReadTransaction(work TransactionWork, configurers ...func(*TransactionConfig)) (interface{}, error)
	// WriteTransaction executes the given unit of work in a AccessModeWrite transaction with
	// retry logic in place
	WriteTransaction(work TransactionWork, configurers ...func(*TransactionConfig)) (interface{}, error)
	// Run executes an auto-commit statement and returns a result
	Run(cypher string, params map[string]interface{}, configurers ...func(*TransactionConfig)) (Result, error)
	// Close closes any open resources and marks this session as unusable
	Close() error
}

Session represents a logical connection (which is not tied to a physical connection) to the server

type SessionConfig added in v1.8.0

type SessionConfig struct {
	AccessMode   AccessMode
	Bookmarks    []string
	DatabaseName string
}

type Statement

type Statement interface {
	// Text returns the statement's text.
	Text() string
	// Params returns the statement's parameters.
	Params() map[string]interface{}
}

type StatementType

type StatementType int

StatementType defines the type of the statement

const (
	// StatementTypeUnknown identifies an unknown statement type
	StatementTypeUnknown StatementType = 0
	// StatementTypeReadOnly identifies a read-only statement
	StatementTypeReadOnly StatementType = 1
	// StatementTypeReadWrite identifies a read-write statement
	StatementTypeReadWrite StatementType = 2
	// StatementTypeWriteOnly identifies a write-only statement
	StatementTypeWriteOnly StatementType = 3
	// StatementTypeSchemaWrite identifies a schema-write statement
	StatementTypeSchemaWrite StatementType = 4
)

type Transaction

type Transaction interface {
	// Run executes a statement on this transaction and returns a result
	Run(cypher string, params map[string]interface{}) (Result, error)
	// Commit commits the transaction
	Commit() error
	// Rollback rolls back the transaction
	Rollback() error
	// Close rolls back the actual transaction if it's not already committed/rolled back
	// and closes all resources associated with this transaction
	Close() error
}

Transaction represents a transaction in the Neo4j database

type TransactionConfig

type TransactionConfig struct {
	// Timeout is the configured transaction timeout.
	Timeout time.Duration
	// Metadata is the configured transaction metadata that will be attached to the underlying transaction.
	Metadata map[string]interface{}
}

TransactionConfig holds the settings for explicit and auto-commit transactions. Actual configuration is expected to be done using configuration functions that are predefined, i.e. 'WithTxTimeout' and 'WithTxMetadata', or one that you could write by your own.

type TransactionWork

type TransactionWork func(tx Transaction) (interface{}, error)

TransactionWork represents a unit of work that will be executed against the provided transaction

type TrustStrategy

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

TrustStrategy defines how the driver will establish trust with the neo4j instance

func TrustAny

func TrustAny(verifyHostname bool) TrustStrategy

TrustAny returns a trust strategy which skips trust verification (trusts any certificate provided) and whose hostname verification can be enabled/disabled based on the provided parameter

func TrustOnly

func TrustOnly(verifyHostname bool, certs ...*x509.Certificate) TrustStrategy

TrustOnly returns a trust strategy which uses provided certificates for trust verification and whose hostname verification can be enabled/disabled based on the provided parameter

func TrustSystem

func TrustSystem(verifyHostname bool) TrustStrategy

TrustSystem returns a trust strategy which uses system provided certificates for trust verification and whose hostname verification can be enabled/disabled based on the provided parameter

Directories

Path Synopsis
internal
db
log
utils
This is an internal package and is not part of the public API.
This is an internal package and is not part of the public API.
test-stub
This is an internal package and is not part of the public API.
This is an internal package and is not part of the public API.

Jump to

Keyboard shortcuts

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