pub struct Neo4j { /* private fields */ }
Available on crate feature neo4j only.
Expand description

Neo4j image for testcontainers.

This image is based on the official Neo4j image. The default user is neo4j and the default password is neo. The default version is 5.

Example

use testcontainers::clients::Cli;
use testcontainers_modules::neo4j::Neo4j;

let cli = Cli::default();
let container = cli.run(Neo4j::default());
let uri = format!("bolt://localhost:{}", container.image().bolt_port_ipv4());
let auth_user = container.image().user();
let auth_pass = container.image().password();
// connect to Neo4j with the uri, user and pass

Neo4j Version

The version of the image can be set with the NEO4J_VERSION_TAG environment variable. The default version is 5. The available versions can be found on Docker Hub.

The used version can be retrieved with the version method.

Auth

The default user is neo4j and the default password is neo.

The used user can be retrieved with the user method. The used password can be retrieved with the pass method.

Environment variables

The following environment variables are supported:

  • NEO4J_VERSION_TAG: The default version of the image to use.
  • NEO4J_TEST_USER: The default user to use for authentication.
  • NEO4J_TEST_PASS: The default password to use for authentication.

Neo4j Labs Plugins

Neo4j offers built-in support for Neo4j Labs plugins. The method with_neo4j_labs_plugin can be used to define them.

Supported plugins are APOC, APOC Core, Bloom, Streams, Graph Data Science, and Neo Semantics.

Implementations§

source§

impl Neo4j

source

pub fn new() -> Self

Create a new instance of a Neo4j image.

source

pub fn with_version(self, version: impl Into<Cow<'static, str>>) -> Self

Set the Neo4j version to use. The value must be an existing Neo4j version tag.

source

pub fn with_user(self, user: impl Into<Cow<'static, str>>) -> Self

Set the username to use.

source

pub fn with_password(self, pass: impl Into<Cow<'static, str>>) -> Self

Set the password to use.

source

pub fn without_authentication(self) -> Self

Do not use any authentication on the testcontainer.

Setting this will override any prior usages of Self::with_user and Self::with_password.

source

pub fn with_neo4j_labs_plugin(self, plugins: &[Neo4jLabsPlugin]) -> Self

Add Neo4j lab plugins to get started with the database.

Trait Implementations§

source§

impl Clone for Neo4j

source§

fn clone(&self) -> Neo4j

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Neo4j

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Neo4j

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<Neo4j> for Neo4jImage

source§

fn from(neo4j: Neo4j) -> Self

Converts to this type from the input type.
source§

impl From<Neo4j> for RunnableImage<Neo4jImage>

source§

fn from(neo4j: Neo4j) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Neo4j

source§

fn eq(&self, other: &Neo4j) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Neo4j

source§

impl StructuralEq for Neo4j

source§

impl StructuralPartialEq for Neo4j

Auto Trait Implementations§

§

impl RefUnwindSafe for Neo4j

§

impl Send for Neo4j

§

impl Sync for Neo4j

§

impl Unpin for Neo4j

§

impl UnwindSafe for Neo4j

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.