neo4j

package module
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAcceptCommercialLicenseAgreement added in v0.27.0

func WithAcceptCommercialLicenseAgreement() testcontainers.CustomizeRequestOption

WithAcceptCommercialLicenseAgreement sets the environment variable NEO4J_ACCEPT_LICENSE_AGREEMENT to "yes", indicating that the user accepts the commercial licence agreement of Neo4j Enterprise Edition. The license agreement is available at https://neo4j.com/terms/licensing/.

func WithAcceptEvaluationLicenseAgreement added in v0.27.0

func WithAcceptEvaluationLicenseAgreement() testcontainers.CustomizeRequestOption

WithAcceptEvaluationLicenseAgreement sets the environment variable NEO4J_ACCEPT_LICENSE_AGREEMENT to "eval", indicating that the user accepts the evaluation agreement of Neo4j Enterprise Edition. The evaluation agreement is available at https://neo4j.com/terms/enterprise_us/. Please read the terms of the evaluation agreement before you accept.

func WithAdminPassword

func WithAdminPassword(adminPassword string) testcontainers.CustomizeRequestOption

WithAdminPassword sets the admin password for the default account An empty string disables authentication. The default password is "password".

func WithLabsPlugin

func WithLabsPlugin(plugins ...LabsPlugin) testcontainers.CustomizeRequestOption

WithLabsPlugin registers one or more Neo4jLabsPlugin for download and server startup. There might be plugins not supported by your selected version of Neo4j.

func WithLogger

func WithLogger(logger testcontainers.Logging) testcontainers.CustomizeRequestOption

WithLogger sets a custom logger to be used by the container Consider calling this before other "With functions" as these may generate logs

func WithNeo4jSetting

func WithNeo4jSetting(key, value string) testcontainers.CustomizeRequestOption

WithNeo4jSetting adds Neo4j a single configuration setting to the container. The setting can be added as in the official Neo4j configuration, the function automatically translates the setting name (e.g. dbms.tx_log.rotation.size) into the format required by the Neo4j container. This function can be called multiple times. A warning is emitted if a key is overwritten. See WithNeo4jSettings to add multiple settings at once Note: credentials must be configured with WithAdminPassword

func WithNeo4jSettings

func WithNeo4jSettings(settings map[string]string) testcontainers.CustomizeRequestOption

WithNeo4jSettings adds multiple Neo4j configuration settings to the container. The settings can be added as in the official Neo4j configuration, the function automatically translates each setting name (e.g. dbms.tx_log.rotation.size) into the format required by the Neo4j container. This function can be called multiple times. A warning is emitted if a key is overwritten. See WithNeo4jSetting to add a single setting Note: credentials must be configured with WithAdminPassword

func WithoutAuthentication

func WithoutAuthentication() testcontainers.CustomizeRequestOption

WithoutAuthentication disables authentication.

Types

type LabsPlugin

type LabsPlugin string
const (
	Apoc             LabsPlugin = "apoc"
	ApocCore         LabsPlugin = "apoc-core"
	Bloom            LabsPlugin = "bloom"
	GraphDataScience LabsPlugin = "graph-data-science"
	NeoSemantics     LabsPlugin = "n10s"
	Streams          LabsPlugin = "streams"
)

type Neo4jContainer

type Neo4jContainer struct {
	testcontainers.Container
}

Neo4jContainer represents the Neo4j container type used in the module

func RunContainer

func RunContainer(ctx context.Context, options ...testcontainers.ContainerCustomizer) (*Neo4jContainer, error)

RunContainer creates an instance of the Neo4j container type

Example
// runNeo4jContainer {
ctx := context.Background()

testPassword := "letmein!"

neo4jContainer, err := neo4j.RunContainer(ctx,
	testcontainers.WithImage("docker.io/neo4j:4.4"),
	neo4j.WithAdminPassword(testPassword),
	neo4j.WithLabsPlugin(neo4j.Apoc),
	neo4j.WithNeo4jSetting("dbms.tx_log.rotation.size", "42M"),
)
if err != nil {
	log.Fatalf("failed to start container: %s", err)
}

// Clean up the container
defer func() {
	if err := neo4jContainer.Terminate(ctx); err != nil {
		log.Fatalf("failed to terminate container: %s", err)
	}
}()
// }

state, err := neo4jContainer.State(ctx)
if err != nil {
	log.Fatalf("failed to get container state: %s", err) // nolint:gocritic
}

fmt.Println(state.Running)
Output:

true

func (Neo4jContainer) BoltUrl

func (c Neo4jContainer) BoltUrl(ctx context.Context) (string, error)

BoltUrl returns the bolt url for the Neo4j container, using the bolt port, in the format of neo4j://host:port

Jump to

Keyboard shortcuts

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