- All Known Implementing Classes:
MongoDbClient
public interface DbClient
Helidon database client.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
Helidon database handler builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic DbClient.Builder
builder()
Create Helidon database handler builder.static DbClient.Builder
Create a Helidon database handler builder from configuration.static DbClient.Builder
builder
(DbClientProvider source) Create Helidon database handler builder.static DbClient.Builder
Create Helidon database handler builder.static DbClient
Create Helidon database handler builder.dbType()
Type of this database provider (such as jdbc:mysql, mongoDB etc.).<U,
T extends Subscribable<U>>
TExecute database statement.<U,
T extends Subscribable<U>>
TinTransaction
(Function<DbTransaction, T> executor) Execute database statements in transaction.<C> Single<C>
Unwrap database client internals.
-
Method Details
-
inTransaction
Execute database statements in transaction. -
execute
Execute database statement. -
dbType
String dbType()Type of this database provider (such as jdbc:mysql, mongoDB etc.).- Returns:
- name of the database provider
-
unwrap
Unwrap database client internals. Only database connection is supported. Any operations based on this connection are blocking. Reactive support must be implemented in user code.- Type Parameters:
C
- target class to be unwrapped- Parameters:
cls
- target class to be unwrapped- Returns:
- database client internals future matching provided class.
- Throws:
UnsupportedOperationException
- when provided class is not supported
-
create
Create Helidon database handler builder.- Parameters:
config
- name of the configuration node with driver configuration- Returns:
- database handler builder
-
builder
Create Helidon database handler builder.Database driver is loaded as SPI provider which implements
DbClientProvider
interface. First provider on the class path is selected.- Returns:
- database handler builder
-
builder
Create Helidon database handler builder.- Parameters:
source
- database driver- Returns:
- database handler builder
-
builder
Create Helidon database handler builder.Database driver is loaded as SPI provider which implements
DbClientProvider
interface. Provider on the class path with matching name is selected.- Parameters:
dbSource
- SPI provider name- Returns:
- database handler builder
-
builder
Create a Helidon database handler builder from configuration.- Parameters:
dbConfig
- configuration that should contain the keysource
that defines the type of this database and is used to load appropriateDbClientProvider
from Java Service loader- Returns:
- a builder pre-configured from the provided config
-