neo4j

package
v4.17.0-clickv2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 10 Imported by: 0

README

neo4j

The Neo4j driver (bolt) does not natively support executing multiple statements in a single query. To allow for multiple statements in a single migration, you can use the x-multi-statement param. This mode splits the migration text into separately-executed statements by a semi-colon ;. Thus x-multi-statement cannot be used when a statement in the migration contains a string with a semi-colon. The queries should run in a single transaction, so partial migrations should not be a concern, but this is untested.

neo4j://user:password@host:port/

URL Query WithInstance Config Description
x-multi-statement MultiStatement Enable multiple statements to be ran in a single migration (See note above)
user Contained within AuthConfig The user to sign in as
password Contained within AuthConfig The user's password
host The host to connect to. Values that start with / are for unix domain sockets. (default is localhost)
port The port to bind to. (default is 7687)
MigrationsLabel Name of the migrations node label

Supported versions

Only Neo4j v3.5+ is supported

Documentation

Index

Constants

View Source
const DefaultMigrationsLabel = "SchemaMigration"

Variables

View Source
var (
	StatementSeparator           = []byte(";")
	DefaultMultiStatementMaxSize = 10 * 1 << 20 // 10 MB
)
View Source
var (
	ErrNilConfig = fmt.Errorf("no config")
)

Functions

func WithInstance

func WithInstance(driver neo4j.Driver, config *Config) (database.Driver, error)

Types

type Config

type Config struct {
	MigrationsLabel       string
	MultiStatement        bool
	MultiStatementMaxSize int
}

type MigrationRecord

type MigrationRecord struct {
	Version int
	Dirty   bool
}

type Neo4j

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

func (*Neo4j) Close

func (n *Neo4j) Close() error

func (*Neo4j) Drop

func (n *Neo4j) Drop() (err error)

func (*Neo4j) Lock

func (n *Neo4j) Lock() error

local locking in order to pass tests, Neo doesn't support database locking

func (*Neo4j) Open

func (n *Neo4j) Open(url string) (database.Driver, error)

func (*Neo4j) Run

func (n *Neo4j) Run(migration io.Reader) (err error)

func (*Neo4j) SetVersion

func (n *Neo4j) SetVersion(version int, dirty bool) (err error)

func (*Neo4j) Unlock

func (n *Neo4j) Unlock() error

func (*Neo4j) Version

func (n *Neo4j) Version() (version int, dirty bool, err error)

Jump to

Keyboard shortcuts

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