OctaviusClientImpl

internal class OctaviusClientImpl(provider: SessionProvider, onClose: () -> Unit? = null, dynamicJson: Json = octaviusJson, dynamicWriteStrategy: DynamicWriteStrategy = DynamicWriteStrategy.AUTOMATIC_WHEN_UNAMBIGUOUS) : OctaviusClient

The only implementation of OctaviusClient. Everything it does, it does through its SessionProvider.

Parameters

provider

Decides which session each operation runs on.

onClose

What close should release, or null where the client owns nothing.

dynamicJson

How dynamic_dto payloads are read and written.

dynamicWriteStrategy

When an unwrapped instance of a registered class is written as a dynamic_dto.

Constructors

Link copied to clipboard
constructor(provider: SessionProvider, onClose: () -> Unit? = null, dynamicJson: Json = octaviusJson, dynamicWriteStrategy: DynamicWriteStrategy = DynamicWriteStrategy.AUTOMATIC_WHEN_UNAMBIGUOUS)

Properties

Link copied to clipboard
open override val dynamicTypes: DynamicTypes

The dynamic_dto types this client knows: where they are registered, and where a value is wrapped for writing.

Functions

Link copied to clipboard
open override fun close()

Releases what this client holds. A data source it was given rather than built is not closed.

Link copied to clipboard
open override fun deleteFrom(table: String): DeleteQuery

Starts building a DELETE from the given table. A WHERE is required before it will render.

Link copied to clipboard
open override fun <T> execute(block: OctaviusSessionOperations.() -> T): T

Runs block on a session, and gives that session back when it returns.

Link copied to clipboard
open fun executeTransactionPlan(plan: TransactionPlan, propagation: TransactionPropagation = TransactionPropagation.REQUIRED, isolation: TransactionIsolationLevel? = null, readOnly: Boolean = false, statementTimeout: Duration? = null, transactionTimeout: Duration? = null): TransactionPlanResult

Runs every step of plan in one transaction, in the order they were added, and returns what each produced.

Link copied to clipboard
open override fun insertInto(table: String): InsertQuery

Starts building an INSERT into the given table.

Link copied to clipboard
open override fun rawQuery(sql: String): RawQuery

Prepares SQL written by hand, with @name parameters.

Link copied to clipboard
open override fun select(vararg columns: String): SelectQuery

Starts building a SELECT over the given columns.

Link copied to clipboard
open override fun <T> transaction(propagation: TransactionPropagation = TransactionPropagation.REQUIRED, isolation: TransactionIsolationLevel? = null, readOnly: Boolean = false, statementTimeout: Duration? = null, transactionTimeout: Duration? = null, block: OctaviusClient.() -> T): T

Runs block inside a transaction, committing when it returns and rolling back when it throws.

Link copied to clipboard
open fun <T> transactionResult(propagation: TransactionPropagation = TransactionPropagation.REQUIRED, isolation: TransactionIsolationLevel? = null, readOnly: Boolean = false, statementTimeout: Duration? = null, transactionTimeout: Duration? = null, block: OctaviusClient.() -> DataResult<T>): DataResult<T>

Runs block in a transaction that understands a returned failure, and hands back what it produced.

Link copied to clipboard
open override fun update(table: String): UpdateQuery

Starts building an UPDATE of the given table. A WHERE is required before it will render.