@API(status=STABLE,
since="6.0")
public interface Neo4jClient
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Neo4jClient.BindSpec<S extends Neo4jClient.BindSpec<S>>
Contract for binding parameters to a query.
|
static class |
Neo4jClient.Builder
A builder for
Neo4j clients. |
static class |
Neo4jClient.IllegalDatabaseNameException
Indicates an illegal database name and is not translated into a
DataAccessException. |
static interface |
Neo4jClient.MappingSpec<T> |
static interface |
Neo4jClient.OngoingBindSpec<T,S extends Neo4jClient.BindSpec<S>>
Ongoing bind specification.
|
static interface |
Neo4jClient.OngoingDelegation<T>
A contract for an ongoing delegation in the selected database.
|
static interface |
Neo4jClient.RecordFetchSpec<T> |
static interface |
Neo4jClient.RunnableDelegation<T>
A runnable delegation.
|
static interface |
Neo4jClient.RunnableSpec
Contract for a runnable query that can be either run returning its result, run without results or be
parameterized.
|
static interface |
Neo4jClient.RunnableSpecBoundToDatabase
Contract for a runnable query inside a dedicated database.
|
static interface |
Neo4jClient.RunnableSpecBoundToDatabaseAndUser
Combination of
Neo4jClient.RunnableSpecBoundToDatabase and Neo4jClient.RunnableSpecBoundToUser, can't be
bound any further. |
static interface |
Neo4jClient.RunnableSpecBoundToUser
Contract for a runnable query bound to a user to be impersonated.
|
static interface |
Neo4jClient.UnboundRunnableSpec
Contract for a runnable query specification which still can be bound to a specific database and an impersonated user.
|
| Modifier and Type | Field and Description |
|---|---|
static LogAccessor |
cypherLog |
static LogAccessor |
log |
| Modifier and Type | Method and Description |
|---|---|
static Neo4jClient |
create(org.neo4j.driver.Driver driver) |
static Neo4jClient |
create(org.neo4j.driver.Driver driver,
DatabaseSelectionProvider databaseSelectionProvider) |
<T> Neo4jClient.OngoingDelegation<T> |
delegateTo(Function<org.neo4j.driver.QueryRunner,Optional<T>> callback)
Delegates interaction with the default database to the given callback.
|
DatabaseSelectionProvider |
getDatabaseSelectionProvider()
Returns the assigned database selection provider.
|
default org.neo4j.driver.QueryRunner |
getQueryRunner() |
default org.neo4j.driver.QueryRunner |
getQueryRunner(DatabaseSelection databaseSelection) |
org.neo4j.driver.QueryRunner |
getQueryRunner(DatabaseSelection databaseSelection,
UserSelection asUser)
Retrieves a query runner that will participate in ongoing Spring transactions (either in declarative
(implicit via
@Transactional) or in programmatically (explicit via transaction template) ones). |
Neo4jClient.UnboundRunnableSpec |
query(String cypher)
Entrypoint for creating a new Cypher query.
|
Neo4jClient.UnboundRunnableSpec |
query(Supplier<String> cypherSupplier)
Entrypoint for creating a new Cypher query based on a supplier.
|
static String |
verifyDatabaseName(String databaseName)
This is a utility method to verify and sanitize a database name.
|
static Neo4jClient.Builder |
with(org.neo4j.driver.Driver driver) |
static final LogAccessor cypherLog
static final LogAccessor log
static Neo4jClient create(org.neo4j.driver.Driver driver)
static Neo4jClient create(org.neo4j.driver.Driver driver, DatabaseSelectionProvider databaseSelectionProvider)
static Neo4jClient.Builder with(org.neo4j.driver.Driver driver)
default org.neo4j.driver.QueryRunner getQueryRunner()
getQueryRunner(DatabaseSelection, UserSelection)default org.neo4j.driver.QueryRunner getQueryRunner(DatabaseSelection databaseSelection)
getQueryRunner(DatabaseSelection, UserSelection)org.neo4j.driver.QueryRunner getQueryRunner(DatabaseSelection databaseSelection, UserSelection asUser)
@Transactional) or in programmatically (explicit via transaction template) ones).
This runner can be used with the Cypher-DSL for example.
If the client cannot retrieve an ongoing Spring transaction, this runner will use auto-commit semantics.databaseSelection - The target database.asUser - As an impersonated user. Requires Neo4j 4.4 and Driver 4.4Neo4jClient.UnboundRunnableSpec query(String cypher)
cypher - The cypher code that shall be executedNeo4jClient.UnboundRunnableSpec query(Supplier<String> cypherSupplier)
cypherSupplier - A supplier of arbitrary Cypher code<T> Neo4jClient.OngoingDelegation<T> delegateTo(Function<org.neo4j.driver.QueryRunner,Optional<T>> callback)
T - The type of the result being producedcallback - A function receiving a statement runner for database interaction that can optionally return a
result.@Nullable DatabaseSelectionProvider getDatabaseSelectionProvider()
@Nullable static String verifyDatabaseName(@Nullable String databaseName)
databaseName - The database name to verify and sanitizeIllegalArgumentException - when the database name is not allowed with the underlying driver.Copyright © 2019–2022 Neo4j, Neo4j Sweden AB. All rights reserved.