Documentation ¶
Overview ¶
Package goBolt implements drivers for the Neo4J Bolt Protocol Versions 1-4.
There are some limitations to the types of collections the internalDriver supports. Specifically, maps should always be of type map[string]interface{} and lists should always be of type []interface{}. It doesn't seem that the Bolt protocol supports uint64 either, so the biggest number it can send right now is the int64 max.
The URL format is: `bolt://(user):(password)@(host):(port)` Schema must be `bolt`. User and password is only necessary if you are authenticating. TLS is supported by using query parameters on the connection string, like so: `bolt://host:port?tls=true&tls_no_verify=false`
The supported query params are:
* timeout - the number of seconds to set the connection timeout to. Defaults to 60 seconds. * tls - Set to 'true' or '1' if you want to use TLS encryption * tls_no_verify - Set to 'true' or '1' if you want to accept any server certificate (for testing, not secure) * tls_ca_cert_file - path to a custom ca cert for a self-signed TLS cert * tls_cert_file - path to a cert file for this client (need to verify this is processed by Neo4j) * tls_key_file - path to a key file for this client (need to verify this is processed by Neo4j)
Errors returned from the API support wrapping, so if you receive an error from the library, it might be wrapping other errors. You can get the innermost error by using the `InnerMost` method. Failure messages from Neo4J are reported, along with their metadata, as an error. In order to get the failure message metadata from a wrapped error, you can do so by calling `err.(*errors.Error).InnerMost().(messages.FailureMessage).Metadata`
If there is an error with the database connection, you should get a sql/internalDriver ErrBadConn as per the best practice recommendations of the Golang SQL Driver. However, this error may be wrapped, so you might have to call `InnerMost` to get it, as specified above.
Index ¶
- type Client
- type ConnectionPooledObjectFactory
- func (c *ConnectionPooledObjectFactory) ActivateObject(ctx context.Context, object *pool.PooledObject) error
- func (c *ConnectionPooledObjectFactory) DestroyObject(ctx context.Context, object *pool.PooledObject) error
- func (c *ConnectionPooledObjectFactory) MakeObject(ctx context.Context) (*pool.PooledObject, error)
- func (c *ConnectionPooledObjectFactory) PassivateObject(ctx context.Context, object *pool.PooledObject) error
- func (c *ConnectionPooledObjectFactory) ValidateObject(ctx context.Context, object *pool.PooledObject) bool
- type Driver
- type DriverPool
- type IClient
- type IDriver
- type IDriverPool
- type Opt
- func WithBasicAuth(username, password string) Opt
- func WithChunkSize(size uint16) Opt
- func WithConnectionString(connString string) Opt
- func WithHostPort(host string, port int) Opt
- func WithProtocolVersionGreaterThan(version int) Opt
- func WithProtocolVersionLessThan(version int) Opt
- func WithProtocolVersionNegotiation() Opt
- func WithRouting() Opt
- func WithStrictProtocolVersion(version int) Opt
- func WithTLS(cacertPath, certPath, keyPath string, tlsNoVerify bool) Opt
- func WithTimeout(timeout time.Duration) Opt
- type RoutingDriverPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NewDriverPool ¶
func (c *Client) NewDriverPool(size int) (IDriverPool, error)
type ConnectionPooledObjectFactory ¶
type ConnectionPooledObjectFactory struct {
// contains filtered or unexported fields
}
func (*ConnectionPooledObjectFactory) ActivateObject ¶
func (c *ConnectionPooledObjectFactory) ActivateObject(ctx context.Context, object *pool.PooledObject) error
func (*ConnectionPooledObjectFactory) DestroyObject ¶
func (c *ConnectionPooledObjectFactory) DestroyObject(ctx context.Context, object *pool.PooledObject) error
func (*ConnectionPooledObjectFactory) MakeObject ¶
func (c *ConnectionPooledObjectFactory) MakeObject(ctx context.Context) (*pool.PooledObject, error)
func (*ConnectionPooledObjectFactory) PassivateObject ¶
func (c *ConnectionPooledObjectFactory) PassivateObject(ctx context.Context, object *pool.PooledObject) error
func (*ConnectionPooledObjectFactory) ValidateObject ¶
func (c *ConnectionPooledObjectFactory) ValidateObject(ctx context.Context, object *pool.PooledObject) bool
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
standard driver is basically a factory its not keeping track of connections connections are expected to be killed when done
func (*Driver) Open ¶
func (d *Driver) Open(mode bolt_mode.AccessMode) (connection.IConnection, error)
mode doesn't matter since its not a pooled or routing driver
type DriverPool ¶
type DriverPool struct {
// contains filtered or unexported fields
}
func (*DriverPool) Close ¶
func (d *DriverPool) Close() error
func (*DriverPool) Open ¶
func (d *DriverPool) Open(mode bolt_mode.AccessMode) (connection.IConnection, error)
func (*DriverPool) Reclaim ¶
func (d *DriverPool) Reclaim(conn connection.IConnection) error
type IClient ¶
type IClient interface { // opens a new internalDriver to neo4j NewDriver() (IDriver, error) // opens a internalDriver pool to neo4j NewDriverPool(size int) (IDriverPool, error) }
type IDriver ¶
type IDriver interface {
Open(mode bolt_mode.AccessMode) (connection.IConnection, error)
}
bolt+routing will not work for non pooled connections
type IDriverPool ¶
type IDriverPool interface { // Open opens a Neo-specific connection. Open(mode bolt_mode.AccessMode) (connection.IConnection, error) Reclaim(connection.IConnection) error Close() error }
type Opt ¶
func WithBasicAuth ¶
allows authentication with basic auth
func WithConnectionString ¶
WithConnectionString provides client option with connection string
func WithHostPort ¶
allows setting the host and port of neo4j
func WithProtocolVersionNegotiation ¶
func WithProtocolVersionNegotiation() Opt
tells client to negotiate version
func WithStrictProtocolVersion ¶
requires protocol version
func WithTimeout ¶
tells client what timeout it should use
type RoutingDriverPool ¶
type RoutingDriverPool struct {
// contains filtered or unexported fields
}
func (*RoutingDriverPool) Close ¶
func (r *RoutingDriverPool) Close() error
func (*RoutingDriverPool) Open ¶
func (r *RoutingDriverPool) Open(mode bolt_mode.AccessMode) (connection.IConnection, error)
func (*RoutingDriverPool) Reclaim ¶
func (r *RoutingDriverPool) Reclaim(conn connection.IConnection) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package encoding is used to encode/decode data going to/from the bolt protocol.
|
Package encoding is used to encode/decode data going to/from the bolt protocol. |
Package errors contains the errors used by the bolt driver.
|
Package errors contains the errors used by the bolt driver. |
Package log implements the logging for the bolt driver
|
Package log implements the logging for the bolt driver |
Package structures contains various structures which are used by the Bolt protocol
|
Package structures contains various structures which are used by the Bolt protocol |
graph
Package graph contains structs that can be returned from the Neo4j Graph
|
Package graph contains structs that can be returned from the Neo4j Graph |
messages
Package messages contains structs that represent the messages that get sent using the Bolt protocol ref here -- https://github.com/neo4j/neo4j-javascript-driver/blob/4.0/src/internal/request-message.js and here -- https://github.com/neo4j/neo4j-javascript-driver/blob/4.0/src/internal/connection-channel.js
|
Package messages contains structs that represent the messages that get sent using the Bolt protocol ref here -- https://github.com/neo4j/neo4j-javascript-driver/blob/4.0/src/internal/request-message.js and here -- https://github.com/neo4j/neo4j-javascript-driver/blob/4.0/src/internal/connection-channel.js |