AuditableDatabaseService

Represents a database service that performs operations involving entities implementing the Auditable interface. This service provides convenient methods for persisting and managing auditable entities while ensuring proper handling of audit-related fields such as createdAt, createdBy, updatedAt, and updatedBy.

Type Parameters

T

The type of the entity managed by this service. Must implement the Auditable interface.

Properties

Link copied to clipboard
open val app: Application
Link copied to clipboard
abstract val db: Driver
Link copied to clipboard
abstract val repo: AuditableRepository<T>

Functions

Link copied to clipboard
open suspend fun ctx(): ExecContext
Link copied to clipboard
context(_: QueryExecutor)
open suspend fun T.save(): DbResult<T>
Link copied to clipboard
context(ec: ExecContext)
inline suspend fun <R> DatabaseService.withTransaction(crossinline block: context(Transaction) suspend () -> R): R

Executes a transactional context for a given operation. The operation is wrapped in a database transaction and executed while tracking its duration using OpenTelemetry.