neo4j

package
v1.7.0-alpha4 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: Apache-2.0 Imports: 16 Imported by: 138

Documentation

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
)
View Source
const (
	// StatementTypeUnknown identifies an unknown statement type
	StatementTypeUnknown StatementType = 0
	// StatementTypeReadOnly identifies a read-only statement
	StatementTypeReadOnly = 1
	// StatementTypeReadWrite identifies a read-write statement
	StatementTypeReadWrite = 2
	// StatementTypeWriteOnly identifies a write-only statement
	StatementTypeWriteOnly = 3
	// StatementTypeSchemaWrite identifies a schema-write statement
	StatementTypeSchemaWrite = 4
)

Variables

This section is empty.

Functions

This section is empty.

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 = 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 and password

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
	// Logging target the driver will send its log outputs
	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.
	AddressResolver ServerAddressResolver
	// Maximum amount of duration a retriable operation would continue retrying
	MaxTransactionRetryDuration time.Duration
	// Maximum number of connections per URL to allow on this driver
	MaxConnectionPoolSize int
}

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

type Counters

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

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

func (*Counters) ConstraintsAdded

func (counters *Counters) ConstraintsAdded() int

func (*Counters) ConstraintsRemoved

func (counters *Counters) ConstraintsRemoved() int

func (*Counters) IndexesAdded

func (counters *Counters) IndexesAdded() int

func (*Counters) IndexesRemoved

func (counters *Counters) IndexesRemoved() int

func (*Counters) LabelsAdded

func (counters *Counters) LabelsAdded() int

func (*Counters) LabelsRemoved

func (counters *Counters) LabelsRemoved() int

func (*Counters) NodesCreated

func (counters *Counters) NodesCreated() int

func (*Counters) NodesDeleted

func (counters *Counters) NodesDeleted() int

func (*Counters) PropertiesSet

func (counters *Counters) PropertiesSet() int

func (*Counters) RelationshipsCreated

func (counters *Counters) RelationshipsCreated() int

func (*Counters) RelationshipsDeleted

func (counters *Counters) RelationshipsDeleted() int

type Date

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

func DateOf

func DateOf(of time.Time) Date

func (Date) Day

func (date Date) Day() int

func (Date) Month

func (date Date) Month() time.Month

func (Date) String

func (date Date) String() string

func (Date) Time

func (date Date) Time() time.Time

func (Date) Year

func (date Date) Year() int

type Driver

type Driver interface {
	// The url this driver is bootstrapped
	Target() url.URL
	Session(accessMode AccessMode, bookmarks ...string) (*Session, error)
	// Close the driver and all underlying connections
	Close() error
	// contains filtered or unexported methods
}

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 method to the neo4j driver to create an instance of a Driver

type Duration

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

func DurationOf

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

func (Duration) Days

func (duration Duration) Days() int64

func (Duration) Months

func (duration Duration) Months() int64

func (Duration) Nanos

func (duration Duration) Nanos() int

func (Duration) Seconds

func (duration Duration) Seconds() int64

func (Duration) String

func (duration Duration) String() string

type InputPosition

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

InputPosition contains information about a specific position in a statement

func (*InputPosition) Column

func (pos *InputPosition) Column() int

func (*InputPosition) Line

func (pos *InputPosition) Line() int

func (*InputPosition) Offset

func (pos *InputPosition) Offset() int

type LocalDateTime

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

func LocalDateTimeOf

func LocalDateTimeOf(of time.Time) LocalDateTime

func (LocalDateTime) Day

func (localTime LocalDateTime) Day() int

func (LocalDateTime) Hour

func (localTime LocalDateTime) Hour() int

func (LocalDateTime) Minute

func (localTime LocalDateTime) Minute() int

func (LocalDateTime) Month

func (localTime LocalDateTime) Month() time.Month

func (LocalDateTime) Nanosecond

func (localTime LocalDateTime) Nanosecond() int

func (LocalDateTime) Second

func (localTime LocalDateTime) Second() int

func (LocalDateTime) String

func (localTime LocalDateTime) String() string

func (LocalDateTime) Time

func (localTime LocalDateTime) Time() time.Time

func (LocalDateTime) Year

func (localTime LocalDateTime) Year() int

type LocalTime

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

func LocalTimeOf

func LocalTimeOf(of time.Time) LocalTime

func (LocalTime) Hour

func (localTime LocalTime) Hour() int

func (LocalTime) Minute

func (localTime LocalTime) Minute() int

func (LocalTime) Nanosecond

func (localTime LocalTime) Nanosecond() int

func (LocalTime) Second

func (localTime LocalTime) Second() int

func (LocalTime) String

func (localTime LocalTime) String() string

func (LocalTime) Time

func (localTime LocalTime) Time() time.Time

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() int64
	Labels() []string
	Props() map[string]interface{}
}

Node represents a node in the neo4j graph database

type Notification

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

Notification contains information about notifications generated by the server

func (*Notification) Code

func (notification *Notification) Code() string

func (*Notification) Description

func (notification *Notification) Description() string

func (*Notification) Position

func (notification *Notification) Position() *InputPosition

func (*Notification) Severity

func (notification *Notification) Severity() string

func (*Notification) Title

func (notification *Notification) Title() string

type OffsetTime

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

func OffsetTimeOf

func OffsetTimeOf(of time.Time) OffsetTime

func (OffsetTime) Hour

func (offsetTime OffsetTime) Hour() int

func (OffsetTime) Minute

func (offsetTime OffsetTime) Minute() int

func (OffsetTime) Nanosecond

func (offsetTime OffsetTime) Nanosecond() int

func (OffsetTime) Offset

func (offsetTime OffsetTime) Offset() int

func (OffsetTime) Second

func (offsetTime OffsetTime) Second() int

func (OffsetTime) String

func (offsetTime OffsetTime) String() string

func (OffsetTime) Time

func (offsetTime OffsetTime) Time() time.Time

type Path

type Path interface {
	Nodes() []Node
	Relationships() []Relationship
}

type Plan

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

Plan describes the plan that the database planner produced

func (*Plan) Arguments

func (plan *Plan) Arguments() map[string]interface{}

func (*Plan) Children

func (plan *Plan) Children() []Plan

func (*Plan) Identifiers

func (plan *Plan) Identifiers() []string

func (*Plan) Operator

func (plan *Plan) Operator() string

type Point

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

func NewPoint2D

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

func NewPoint3D

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

func (*Point) SrId

func (point *Point) SrId() int

func (*Point) String

func (point *Point) String() string

func (*Point) X

func (point *Point) X() float64

func (*Point) Y

func (point *Point) Y() float64

func (*Point) Z

func (point *Point) Z() float64

type ProfiledPlan

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

Profile describes the plan that the database planner produced and executed

func (*ProfiledPlan) Arguments

func (plan *ProfiledPlan) Arguments() map[string]interface{}

func (*ProfiledPlan) Children

func (plan *ProfiledPlan) Children() []ProfiledPlan

func (*ProfiledPlan) DbHits

func (plan *ProfiledPlan) DbHits() int64

func (*ProfiledPlan) Identifiers

func (plan *ProfiledPlan) Identifiers() []string

func (*ProfiledPlan) Operator

func (plan *ProfiledPlan) Operator() string

func (*ProfiledPlan) Records

func (plan *ProfiledPlan) Records() int64

type Record

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

Record contains ordered keys and values that are returned from a statement executed on the server

func (*Record) Get

func (record *Record) Get(key string) (interface{}, bool)

Get returns the value (if any) corresponding to the given key

func (*Record) GetByIndex

func (record *Record) GetByIndex(index int) interface{}

GetByIndex returns the value at given index

func (*Record) Keys

func (record *Record) Keys() []string

Keys returns the keys available

func (*Record) Values

func (record *Record) Values() []interface{}

Values returns the values

type Relationship

type Relationship interface {
	Id() int64
	StartId() int64
	EndId() int64
	Type() string
	Props() map[string]interface{}
}

Relationship represents a relationship in the neo4j graph database

type Result

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

Result provides access to the result of the executing statement

func (*Result) Consume

func (result *Result) Consume() (*ResultSummary, error)

Consume consumes the entire result and returns the summary information about the statement execution

func (*Result) Err

func (result *Result) Err() error

Err returns the latest error that caused this Next to return false

func (*Result) Keys

func (result *Result) Keys() ([]string, error)

Keys returns the keys available on the result set

func (*Result) Next

func (result *Result) Next() bool

Next returns true only if there is a record to be processed

func (*Result) Record

func (result *Result) Record() *Record

Record returns the current record

func (*Result) Summary

func (result *Result) Summary() (*ResultSummary, error)

Summary returns the summary information about the statement execution

type ResultSummary

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

ResultSummary contains information about statement execution.

func (*ResultSummary) Counters

func (summary *ResultSummary) Counters() *Counters

func (*ResultSummary) Notifications

func (summary *ResultSummary) Notifications() []Notification

func (*ResultSummary) Plan

func (summary *ResultSummary) Plan() *Plan

func (*ResultSummary) Profile

func (summary *ResultSummary) Profile() *ProfiledPlan

func (*ResultSummary) ResultAvailableAfter

func (summary *ResultSummary) ResultAvailableAfter() time.Duration

func (*ResultSummary) ResultConsumedAfter

func (summary *ResultSummary) ResultConsumedAfter() time.Duration

func (*ResultSummary) Server

func (summary *ResultSummary) Server() *ServerInfo

func (*ResultSummary) Statement

func (summary *ResultSummary) Statement() *Statement

func (*ResultSummary) StatementType

func (summary *ResultSummary) StatementType() StatementType

type Segment

type Segment interface {
	Start() Node
	Relationship() Relationship
	End() Node
}

type ServerAddress

type ServerAddress interface {
	Hostname() string
	Port() string
}

func NewServerAddress

func NewServerAddress(hostname string, port string) ServerAddress

type ServerAddressResolver

type ServerAddressResolver interface {
	Resolve(address ServerAddress) []ServerAddress
}

type ServerInfo

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

ServerInfo contains basic information of the server

func (*ServerInfo) Address

func (server *ServerInfo) Address() string

func (*ServerInfo) Version

func (server *ServerInfo) Version() string

type Session

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

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

func (*Session) BeginTransaction

func (session *Session) BeginTransaction() (*Transaction, error)

BeginTransaction starts a new explicit transaction on this session

func (*Session) Close

func (session *Session) Close() error

Close closes any open resources and marks this session as unusable

func (*Session) LastBookmark

func (session *Session) LastBookmark() string

func (*Session) ReadTransaction

func (session *Session) ReadTransaction(work TransactionWork) (interface{}, error)

ReadTransaction executes the given unit of work in a AccessModeRead transaction with retry logic in place

func (*Session) Run

func (session *Session) Run(cypher string, params *map[string]interface{}) (*Result, error)

Run executes an auto-commit statement and returns a result

func (*Session) WriteTransaction

func (session *Session) WriteTransaction(work TransactionWork) (interface{}, error)

WriteTransaction executes the given unit of work in a AccessModeWrite transaction with retry logic in place

type Statement

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

Statement represents a statement along with its parameters (if any)

func (*Statement) Cypher

func (statement *Statement) Cypher() string

func (*Statement) Params

func (statement *Statement) Params() *map[string]interface{}

type StatementType

type StatementType int

StatementType defines the type of the statement

type Transaction

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

Transaction represents a transaction in the Neo4j database

func (*Transaction) Close

func (transaction *Transaction) Close() error

Close rolls back the actual transaction if it's not already committed/rolled back and closes all resources associated with this transaction

func (*Transaction) Commit

func (transaction *Transaction) Commit() error

Commit commits the transaction

func (*Transaction) Rollback

func (transaction *Transaction) Rollback() error

Rollback rolls back the transaction

func (*Transaction) Run

func (transaction *Transaction) Run(cypher string, params *map[string]interface{}) (*Result, error)

Run executes a statement on this transaction and returns a result

type TransactionWork

type TransactionWork func(transaction *Transaction) (interface{}, error)

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

type Version

type Version struct {
	// contains filtered or unexported fields
}
var (
	V3_4_0 Version = Version{3, 4, 0}
)

func VersionOf

func VersionOf(server string) Version

func VersionOfDriver

func VersionOfDriver(driver Driver) Version

func (Version) GreaterThan

func (version Version) GreaterThan(other Version) bool

func (Version) GreaterThanOrEqual

func (version Version) GreaterThanOrEqual(other Version) bool

func (Version) LessThan

func (version Version) LessThan(other Version) bool

func (Version) LessThanOrEqual

func (version Version) LessThanOrEqual(other Version) bool

func (Version) String

func (version Version) String() string

Directories

Path Synopsis
integration-tests
internal
mocking
Package connector-mocks is a generated GoMock package.
Package connector-mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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