data class User(
var name: String? = null,
val mobile: String,
var email: String? = null
) : Principal, BaseTable()
Ideally, what I would want is to have the common logic for the generation of the lastModified, createdAt fields to reside in some common class (e.g: BaseTable)
abstract class BaseTable {
private lateinit var createdAt: DateTime
private lateinit var lastModified: DateTime
}
Which would act as the parent of all my models since I want the createdAt and lastModified fields in every table.
To be clear, here is the behavior I want:
- createdAt: Just store the time when the row was created, and never change again
- lastModified: Every time a row is updated, update this field as well. When a new row is created createdAt = lastModified.
Is there a way to do this using Kotlin (Jetbrains) Exposed SQL library?