# Package-level declarations

## Types

CompositeEntity
Link copied to clipboard
abstract class CompositeEntity(id: EntityID<CompositeID>) : Entity<CompositeID>

Base class for an Entity instance identified by an id comprised of multiple wrapped values.

CompositeEntityClass
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 representing the EntityClass that manages CompositeEntity instances and maintains their relation to the provided table.

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

Class representing a wrapper for a stored identity value of type T, which is managed and cached by an EntityClass using a data access object pattern.

DaoEntityIDFactory
Link copied to clipboard
class DaoEntityIDFactory : EntityIDFactory

Class representing a producer of EntityID instances, which are managed and cached by their respective EntityClass instances using a data access object pattern.

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

Class representing a mapping to values stored in a table record in a database.

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

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

EntityCache
Link copied to clipboard
class EntityCache(transaction: Transaction)

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

EntityChange
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.

EntityChangeType
Link copied to clipboard
enum EntityChangeType : Enum<EntityChangeType>

Represents the possible states of an Entity throughout its lifecycle.

EntityClass
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)

Base class responsible for the management of Entity instances and the maintenance of their relation to the provided table.

EntityFieldWithTransform
Link copied to clipboard
open class EntityFieldWithTransform<Unwrapped, Wrapped>(val column: Column<Unwrapped>, transformer: ColumnTransformer<Unwrapped, Wrapped>, cacheResult: Boolean = false) : ColumnTransformer<Unwrapped, Wrapped>

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

EntityHook
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.

EntityLifecycleInterceptor
Link copied to clipboard
class EntityLifecycleInterceptor : GlobalStatementInterceptor

Represents a StatementInterceptor specifically responsible for the statement lifecycle of Entity instances, which is loaded whenever a Transaction instance is initialized.

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

Base class responsible for the management of immutable Entity instances and the maintenance of their relation to the provided table. An internal cache is used to store entity loading states by the associated database, in order to guarantee that that entity updates are synchronized with this class as the lock object.

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

Base class responsible for the management of immutable Entity instances and the maintenance of their relation to the provided table.

InnerTableLink
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) : ReadWriteProperty<Source, SizedIterable<Target>>

Class responsible for implementing property delegates of the read-write properties involved in a many-to-many relation, which uses an intermediate (join) table.

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

Base class for an Entity instance identified by an id comprised of a wrapped `Int` value.

IntEntityClass
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 representing the EntityClass that manages IntEntity instances and maintains their relation to the provided table.

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

Base class for an Entity instance identified by an id comprised of a wrapped `Long` value.

LongEntityClass
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 representing the EntityClass that manages LongEntity instances and maintains their relation to the provided table.

OptionalBackReference
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) : ReadOnlyProperty<Child, Parent?>

Class responsible for implementing property delegates of the read-only properties involved in an optional table relation between two Entity classes, which retrieves the child entity that optionally references the parent entity.

OptionalReference
Link copied to clipboard
class OptionalReference<REF : Any, ID : Any, out Target : Entity<ID>>(val reference: Column<REF?>, val factory: EntityClass<ID, Target>, 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.

Reference
Link copied to clipboard
class Reference<REF : Any, ID : Any, out Target : Entity<ID>>(val reference: Column<REF>, val factory: EntityClass<ID, Target>, 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.

Referrers
Link copied to clipboard
open 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) : ReadOnlyProperty<Parent, SizedIterable<Child>>

Class responsible for implementing property delegates of the read-only properties involved in a one-to-many relation, which retrieves all child entities that reference the parent entity.

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

Base class for an Entity instance identified by an id comprised of a wrapped `UInt` value.

UIntEntityClass
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 representing the EntityClass that manages UIntEntity instances and maintains their relation to the provided table.

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

Base class for an Entity instance identified by an id comprised of a wrapped `ULong` value.

ULongEntityClass
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 representing the EntityClass that manages ULongEntity instances and maintains their relation to the provided table.

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

Base class for an Entity instance identified by an id comprised of a wrapped kotlin.uuid.Uuid value.

UuidEntityClass
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 representing the EntityClass that manages UuidEntity instances and maintains their relation to the provided table.

View
Link copied to clipboard
class View<out Target : Entity<*>>(val op: Op<Boolean>, val factory: EntityClass<*, Target>) : SizedIterable<Target>

A SizedIterable of Entity instances that represent a subset of all managed entities that conform to the provided op conditional expression.

## Properties

entityCache
Link copied to clipboard
val Transaction.entityCache: EntityCache

The current EntityCache for this scope, or a new instance if none exists.

## Functions

alertSubscribers
Link copied to clipboard
fun Transaction.alertSubscribers()

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

flushCache
Link copied to clipboard
fun Transaction.flushCache(): List<Entity<*>>

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

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

Eager loads references for this Entity instance and returns this entity instance.

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

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

registeredChanges
Link copied to clipboard
fun Transaction.registeredChanges(): List<EntityChange?>

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

toEntity
Link copied to clipboard
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.

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 EntityClass type is neither equivalent to nor a subclass of klass, or if the entity is not found.

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

Eager loads references for all Entity instances in this collection and returns this collection.

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

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