Package-level declarations

Types

Link copied to clipboard
class Accessor<ID : Any, Parent : Entity<ID>, REF : Any>(reference: Column<REF>, factory: EntityClass<ID, Parent>, entity: Entity<*>, references: Map<Column<*>, Column<*>>? = null)

What a non-nullable many-to-one reference declared with referencedOn gives back. Declare the property as a val, read the referenced entity by invoking it, and write it with set:

Link copied to clipboard
class BackReference<ParentID : Any, out Parent : Entity<ParentID>, ChildID : Any, in Child : Entity<ChildID>, REF>(reference: Column<REF>, factory: EntityClass<ParentID, Parent>, references: Map<Column<*>, Column<*>>? = null)

What a one-to-one relationship declared with backReferencedOn gives back: the single child entity that references this one, read by invoking the property.

Link copied to clipboard

Base class for an Entity with an id made of several columns (CompositeID), mapping a table declared as a CompositeIdTable. See Entity for how the entity and its properties are declared.

Link copied to clipboard
abstract class CompositeEntityClass<out E : CompositeEntity>(table: IdTable<CompositeID>, entityType: Class<E>? = null, entityCtor: (EntityID<CompositeID>) -> E? = null) : EntityClass<CompositeID, E>

Base class for the companion object of a CompositeEntity: the entry point for creating, finding, and deleting the rows of table.

Link copied to clipboard
class DaoEntityID<T : Any>(id: T?, table: IdTable<T>) : EntityID<T>

EntityID implementation for R2DBC DAOs. This is the R2DBC equivalent of org.jetbrains.exposed.v1.dao.DaoEntityID.

Link copied to clipboard
open class Entity<ID : Any>(val id: EntityID<ID>)

A row of EntityClass.table, with the columns it should expose declared as delegated properties.

Link copied to clipboard
class EntityBatchUpdate(klass: EntityClass<*, Entity<*>>)

Class responsible for performing a batch update operation on multiple instances of an Entity class.

Link copied to clipboard
class EntityCache(transaction: R2dbcTransaction)

Class responsible for the storage of Entity instances in a specific transaction.

Link copied to clipboard
data class EntityChange(val entityClass: EntityClass<*, Entity<*>>, val entityId: EntityID<*>, val changeType: EntityChangeType, val transactionId: String)

Stores details about a state-change event for an Entity instance.

Link copied to clipboard

Represents the possible states of an Entity throughout its lifecycle.

Link copied to clipboard
abstract class EntityClass<ID : Any, out T : Entity<ID>>(val table: IdTable<ID>, entityType: Class<T>? = null, entityCtor: (EntityID<ID>) -> T? = null)

The entry point for the entities of one table: creating, finding, and deleting them.

Link copied to clipboard

Class responsible for enabling Entity field transformations, which may be useful when advanced database type conversions are necessary for entity mappings.

Link copied to clipboard
object EntityHook

Class responsible for providing functions that expose EntityChange state logic and entity lifecycle features for alerting triggers or customizing additional functionality. Subscribers are suspend because the R2DBC lifecycle runs inside coroutines.

Link copied to clipboard

Represents a GlobalSuspendStatementInterceptor specifically responsible for the statement lifecycle of Entity instances, which is loaded whenever an R2dbcTransaction instance is initialized.

Link copied to clipboard
@RequiresOptIn(message = "This is an experimental Exposed R2DBC DAO API. Its shape may change in incompatible ways, even in patch releases. Opt in with '@OptIn(org.jetbrains.exposed.v1.dao.r2dbc.ExperimentalR2dbcDaoApi::class)' or '@org.jetbrains.exposed.v1.dao.r2dbc.ExperimentalR2dbcDaoApi'.")
annotation class ExperimentalR2dbcDaoApi

API marked with this annotation is experimental. The shape of the R2DBC DAO API may change in incompatible ways while it stabilizes even in patch releases.

Link copied to clipboard
class InnerTableLink<SID : Any, Source : Entity<SID>, ID : Any, Target : Entity<ID>>(val table: Table, sourceTable: IdTable<SID>, val target: EntityClass<ID, Target>, _sourceColumn: Column<EntityID<SID>>? = null, _targetColumn: Column<EntityID<ID>>? = null)

What a many-to-many relationship declared with via gives back: the entities linked to this one through an intermediate table.

Link copied to clipboard

Property delegate companion to InnerTableLink — implements SizedIterable over the linked targets of entity via the join table defined by link. R2DBC-specific because the iteration is built around Flow.collect, whereas the JDBC implementation uses blocking iteration directly on InnerTableLink.

Link copied to clipboard
abstract class IntEntity(id: EntityID<Int>) : Entity<Int>

Base class for an Entity with an Int id, mapping a table declared as an IntIdTable. See Entity for how the entity and its properties are declared.

Link copied to clipboard
abstract class IntEntityClass<out E : IntEntity>(table: IdTable<Int>, entityType: Class<E>? = null, entityCtor: (EntityID<Int>) -> E? = null) : EntityClass<Int, E>

Base class for the companion object of an IntEntity: the entry point for creating, finding, and deleting the rows of table.

Link copied to clipboard
abstract class LongEntity(id: EntityID<Long>) : Entity<Long>

Base class for an Entity with a Long id, mapping a table declared as a LongIdTable. See Entity for how the entity and its properties are declared.

Link copied to clipboard
abstract class LongEntityClass<out E : LongEntity>(table: IdTable<Long>, entityType: Class<E>? = null, entityCtor: (EntityID<Long>) -> E? = null) : EntityClass<Long, E>

Base class for the companion object of a LongEntity: the entry point for creating, finding, and deleting the rows of table.

Link copied to clipboard
class OptionalAccessor<ID : Any, Parent : Entity<ID>, REF : Any>(reference: Column<REF?>, factory: EntityClass<ID, Parent>, entity: Entity<*>, references: Map<Column<*>, Column<*>>? = null)

What a nullable many-to-one reference declared with optionalReferencedOn gives back. Same val + invoke()/set shape as Accessor, except that both ends accept null:

Link copied to clipboard
class OptionalBackReference<ParentID : Any, out Parent : Entity<ParentID>, ChildID : Any, in Child : Entity<ChildID>, REF>(reference: Column<REF?>, factory: EntityClass<ParentID, Parent>, references: Map<Column<*>, Column<*>>? = null)

What a one-to-one relationship declared with optionalBackReferencedOn gives back: the single child entity that references this one, or null if there is none.

Link copied to clipboard
class OptionalReference<ID : Any, Parent : Entity<ID>, REF : Any>(val reference: Column<REF?>, val factory: EntityClass<ID, Parent>, val references: Map<Column<*>, Column<*>>? = null)

Class representing an optional table relation between two Entity classes, which is responsible for retrieving the parent entity optionally referenced by the child entity. R2DBC counterpart of JDBC's OptionalReference; the property delegate yields an OptionalAccessor for suspending lookups.

Link copied to clipboard
class Reference<ID : Any, Parent : Entity<ID>, REF : Any>(val reference: Column<REF>, val factory: EntityClass<ID, Parent>, val references: Map<Column<*>, Column<*>>? = null)

Class representing a table relation between two Entity classes, which is responsible for retrieving the parent entity referenced by the child entity. R2DBC counterpart of JDBC's Reference from References.kt; the property delegate yields an Accessor for suspending lookups.

Link copied to clipboard
class Referrers<ParentID : Any, in Parent : Entity<ParentID>, ChildID : Any, out Child : Entity<ChildID>, REF>(val reference: Column<REF>, val factory: EntityClass<ChildID, Child>, val cache: Boolean, references: Map<Column<*>, Column<*>>? = null)

What a one-to-many relationship declared with referrersOn gives back: every child entity whose reference column points at this one.

Link copied to clipboard
abstract class UIntEntity(id: EntityID<UInt>) : Entity<UInt>

Base class for an Entity with a UInt id, mapping a table declared as a UIntIdTable. See Entity for how the entity and its properties are declared.

Link copied to clipboard
abstract class UIntEntityClass<out E : UIntEntity>(table: IdTable<UInt>, entityType: Class<E>? = null, entityCtor: (EntityID<UInt>) -> E? = null) : EntityClass<UInt, E>

Base class for the companion object of a UIntEntity: the entry point for creating, finding, and deleting the rows of table.

Link copied to clipboard
abstract class ULongEntity(id: EntityID<ULong>) : Entity<ULong>

Base class for an Entity with a ULong id, mapping a table declared as a ULongIdTable. See Entity for how the entity and its properties are declared.

Link copied to clipboard
abstract class ULongEntityClass<out E : ULongEntity>(table: IdTable<ULong>, entityType: Class<E>? = null, entityCtor: (EntityID<ULong>) -> E? = null) : EntityClass<ULong, E>

Base class for the companion object of a ULongEntity: the entry point for creating, finding, and deleting the rows of table.

Link copied to clipboard
abstract class UuidEntity(id: EntityID<Uuid>) : Entity<Uuid>

Base class for an Entity with a client-generated kotlin.uuid.Uuid id, mapping a table declared as a UuidTable. See Entity for how the entity and its properties are declared.

Link copied to clipboard
abstract class UuidEntityClass<out E : UuidEntity>(table: IdTable<Uuid>, entityType: Class<E>? = null, entityCtor: (EntityID<Uuid>) -> E? = null) : EntityClass<Uuid, E>

Base class for the companion object of a UuidEntity: the entry point for creating, finding, and deleting the rows of table.

Properties

Link copied to clipboard

The EntityCache belonging to the transaction, created on first access.

Functions

Link copied to clipboard

Triggers alerts for all unprocessed entity events using any state-change actions previously registered via EntityHook.subscribe.

Link copied to clipboard

Sends all pending Entity inserts and updates stored in this transaction's EntityCache to the database.

Link copied to clipboard
suspend fun <SRCID : Any, SRC : Entity<SRCID>> SRC.load(vararg relations: KProperty1<out Entity<*>, Any?>): SRC

Loads the given relations for this single entity up front:

Link copied to clipboard
fun R2dbcTransaction.registerChange(entityClass: EntityClass<*, Entity<*>>, entityId: EntityID<*>, changeType: EntityChangeType)

Creates a new EntityChange with this id and registers it as an entity event.

Link copied to clipboard

Returns a list of all EntityChange events that have been registered in this R2dbcTransaction.

Link copied to clipboard
suspend fun <ID : Any, T : Entity<ID>> EntityChange.toEntity(): T?

Returns the actual Entity instance associated with this event, or null if the entity is not found.

suspend fun <ID : Any, T : Entity<ID>> EntityChange.toEntity(klass: EntityClass<ID, T>): T?

Returns the actual Entity instance associated with this event, or null if either its class type is neither equivalent to nor a subclass of klass, or if the entity is not found.

Link copied to clipboard
suspend fun <SRCID : Any, SRC : Entity<SRCID>, REF : Entity<*>, L : Iterable<SRC>> L.with(vararg relations: KProperty1<out REF, Any?>): L

Loads the given relations for entities that are already in memory, one query per relation:

suspend fun <SRCID : Any, SRC : Entity<SRCID>, REF : Entity<*>, L : SizedIterable<SRC>> L.with(vararg relations: KProperty1<out REF, Any?>): L

Loads the given relations for every entity of this SizedIterable up front, one query per relation, instead of one query per entity as it is traversed:

Link copied to clipboard
suspend fun <T> withHook(action: suspend (EntityChange) -> Unit, body: suspend () -> T): T

Calls the specified body with the given state-change action, registers the action, and returns its result.