connection

package
v0.2.1-0...-e9d73b1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Version is the current version of this driver
	Version = "0.1"
	// ClientID is the id of this client
	ClientID = "GoBolt/" + Version
)

Functions

This section is empty.

Types

type Connection

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

func (*Connection) Begin

func (c *Connection) Begin() (ITransaction, error)

func (*Connection) BeginWithDatabase

func (c *Connection) BeginWithDatabase(db string) (ITransaction, error)

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Exec

func (c *Connection) Exec(query string, params QueryParams) (IResult, error)

func (*Connection) ExecWithDb

func (c *Connection) ExecWithDb(query string, params QueryParams, db string) (IResult, error)

func (*Connection) GetConnectionId

func (c *Connection) GetConnectionId() string

func (*Connection) GetProtocolVersionBytes

func (c *Connection) GetProtocolVersionBytes() []byte

func (*Connection) GetProtocolVersionNumber

func (c *Connection) GetProtocolVersionNumber() int

func (*Connection) MakeIdle

func (c *Connection) MakeIdle() error

func (*Connection) Query

func (c *Connection) Query(query string, params QueryParams) ([][]interface{}, IResult, error)

func (*Connection) QueryWithDb

func (c *Connection) QueryWithDb(query string, params QueryParams, db string) ([][]interface{}, IResult, error)

func (*Connection) SetChunkSize

func (c *Connection) SetChunkSize(chunkSize uint16)

Sets the size of the chunks to write to the stream

func (*Connection) SetConnectionId

func (c *Connection) SetConnectionId(id string)

func (*Connection) SetTimeout

func (c *Connection) SetTimeout(timeout time.Duration)

Sets the timeout for reading and writing to the stream

func (*Connection) ValidateOpen

func (c *Connection) ValidateOpen() bool

type IConnection

type IConnection interface {
	// Query functionality
	IQuery

	// closes connection
	Close() error

	GetProtocolVersionNumber() int
	GetProtocolVersionBytes() []byte

	// returns true if open, returns false if not
	ValidateOpen() bool

	MakeIdle() error

	Begin() (ITransaction, error)
	BeginWithDatabase(db string) (ITransaction, error)
	// SetTimeout sets the read/write timeouts for the
	// connection to Neo4j
	SetTimeout(time.Duration)
	SetChunkSize(uint16)

	// connection id's are for the routing driver to keep track of connections
	GetConnectionId() string
	SetConnectionId(id string)
	// contains filtered or unexported methods
}

IConnection

func CreateBoltConn

func CreateBoltConn(connStr string) (IConnection, error)

type IQuery

type IQuery interface {
	// ExecNeo executes a runQuery that returns no rows.
	Exec(query string, params QueryParams) (IResult, error)

	ExecWithDb(query string, params QueryParams, db string) (IResult, error)

	// QueryNeo executes a runQuery that returns data.
	Query(query string, params QueryParams) ([][]interface{}, IResult, error)

	QueryWithDb(query string, params QueryParams, db string) ([][]interface{}, IResult, error)
}

type IResult

type IResult interface {
	GetStats() (map[string]interface{}, bool)
	GetNodesCreated() (int64, bool)
	GetRelationshipsCreated() (int64, bool)
	GetNodesDeleted() (int64, bool)
	GetRelationshipsDeleted() (int64, bool)

	// Metadata returns the metadata response from neo4j
	Metadata() map[string]interface{}
}

Result represents a result from a runQuery that returns no data

type ITransaction

type ITransaction interface {
	// Query
	IQuery
	// Commit commits the transaction
	Commit() error
	// Rollback rolls back the transaction
	Rollback() error
	// IsClosed determines if the transaction has been closed
	IsClosed() bool
}

ITransaction controls a transaction

type NeoRows

type NeoRows [][]interface{}

func (*NeoRows) Get2DSlice

func (n *NeoRows) Get2DSlice() [][]interface{}

type QueryParams

type QueryParams map[string]interface{}

func (*QueryParams) GetKeys

func (q *QueryParams) GetKeys() []string

func (*QueryParams) GetMap

func (q *QueryParams) GetMap() map[string]interface{}

Jump to

Keyboard shortcuts

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