-
public interface DbClientHelidon database client.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDbClient.BuilderHelidon database handler builder.
-
Field Summary
Fields Modifier and Type Field Description static StringPING_STATEMENT_NAMEName of the named statement used in database health checks.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description static DbClient.Builderbuilder()Create Helidon database handler builder.static DbClient.Builderbuilder(Config dbConfig)Create a Helidon database handler builder from configuration.static DbClient.Builderbuilder(DbClientProvider source)Create Helidon database handler builder.static DbClient.Builderbuilder(String dbSource)Create Helidon database handler builder.static DbClientcreate(Config config)Create Helidon database handler builder.StringdbType()Type of this database provider (such as jdbc:mysql, mongoDB etc.).<U,T extends io.helidon.common.reactive.Subscribable<U>>
Texecute(Function<DbExecute,T> executor)Execute database statement.<U,T extends io.helidon.common.reactive.Subscribable<U>>
TinTransaction(Function<DbTransaction,T> executor)Execute database statements in transaction.io.helidon.common.reactive.Single<Void>ping()Deprecated.Useio.helidon.dbclient.health.DbClientHealthCheckinstead.
-
-
-
Field Detail
-
PING_STATEMENT_NAME
static final String PING_STATEMENT_NAME
Name of the named statement used in database health checks.- See Also:
- Constant Field Values
-
-
Method Detail
-
inTransaction
<U,T extends io.helidon.common.reactive.Subscribable<U>> T inTransaction(Function<DbTransaction,T> executor)
Execute database statements in transaction.- Type Parameters:
T- statement execution result type, MUST be either aMultior aSingle, as returned by all APIs of DbClient.U- the type provided by the result type- Parameters:
executor- database statement executor, seeDbExecute- Returns:
- statement execution result
-
execute
<U,T extends io.helidon.common.reactive.Subscribable<U>> T execute(Function<DbExecute,T> executor)
Execute database statement.- Type Parameters:
T- statement execution result type, MUST be either aMultior aSingle, as returned by all APIs of DbClientU- the type provided by the result type- Parameters:
executor- database statement executor, seeDbExecute- Returns:
- statement execution result
-
ping
io.helidon.common.reactive.Single<Void> ping()
Deprecated.Useio.helidon.dbclient.health.DbClientHealthCheckinstead.Pings the database, completes when DB is up and ready, completes exceptionally if not. Executes simple SQL query defined asdb.statements.pingconfiguration property.- Returns:
- stage that completes when the ping finished
-
dbType
String dbType()
Type of this database provider (such as jdbc:mysql, mongoDB etc.).- Returns:
- name of the database provider
-
create
static DbClient create(Config config)
Create Helidon database handler builder.- Parameters:
config- name of the configuration node with driver configuration- Returns:
- database handler builder
-
builder
static DbClient.Builder builder()
Create Helidon database handler builder.Database driver is loaded as SPI provider which implements
DbClientProviderinterface. First provider on the class path is selected.- Returns:
- database handler builder
-
builder
static DbClient.Builder builder(DbClientProvider source)
Create Helidon database handler builder.- Parameters:
source- database driver- Returns:
- database handler builder
-
builder
static DbClient.Builder builder(String dbSource)
Create Helidon database handler builder.Database driver is loaded as SPI provider which implements
DbClientProviderinterface. Provider on the class path with matching name is selected.- Parameters:
dbSource- SPI provider name- Returns:
- database handler builder
-
builder
static DbClient.Builder builder(Config dbConfig)
Create a Helidon database handler builder from configuration.- Parameters:
dbConfig- configuration that should contain the keysourcethat defines the type of this database and is used to load appropriateDbClientProviderfrom Java Service loader- Returns:
- a builder pre-configured from the provided config
-
-