LongEntity

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.

Constructors

Link copied to clipboard
constructor(id: EntityID<Long>)

Properties

Link copied to clipboard

This entity's committed column values. Values a transaction has staged but not committed are held by that transaction's EntityCache instead.

Link copied to clipboard

The R2dbcDatabase associated with the record mapped to this Entity instance.

Link copied to clipboard
Link copied to clipboard

The associated EntityClass that manages this Entity instance.

Link copied to clipboard

The final column-value mapping for this Entity instance after being flushed and retrieved from the database.

Functions

Link copied to clipboard
open suspend fun delete()

Deletes this Entity instance, both from the cache and from the database.

Link copied to clipboard
open suspend fun flush(batch: EntityBatchUpdate? = null): Boolean

Sends all cached inserts and updates for this Entity instance to the database.

Link copied to clipboard
operator fun <T> Column<T>.getValue(o: Entity<Long>, desc: KProperty<*>): T

operator fun <T> CompositeColumn<T>.getValue(o: Entity<Long>, desc: KProperty<*>): T

Reads a property delegated to a CompositeColumn, which stores a single value across several columns:

Reads a property delegated to a transformed column, converting the stored value on the way out:

Link copied to clipboard
fun <T> Column<T>.lookup(): T

Returns the value assigned to this column mapping.

Link copied to clipboard
open suspend fun refresh(flush: Boolean = false)

Updates the fields of this Entity instance with values retrieved from the database. Override this function to refresh some additional state, if any.

Link copied to clipboard
operator fun <T> Column<T>.setValue(entity: Entity<Long>, desc: KProperty<*>, value: T)

operator fun <T> CompositeColumn<T>.setValue(o: Entity<Long>, desc: KProperty<*>, value: T)

Writes a property delegated to a CompositeColumn, staging one value per underlying column.

Writes a property delegated to a transformed column, converting the value back to what the column stores.

Link copied to clipboard

Declares a many-to-many relationship held by the intermediate table, whose references to this entity's table and to the target's table are inferred from its foreign keys:

Declares a many-to-many relationship, naming sourceColumn and targetColumn explicitly. Use this overload when the intermediate table holds more than one reference to either side, which leaves nothing to infer: