https://kotlinlang.org logo
w

Wyatt Kennedy

08/31/2020, 7:58 PM
Hi, I've been working on a project using exposed for a bit and was wondering if there is any convenience functionality for audit fields like created & updated timestamps or soft delete logic with a deleted column? If so, is it documented anywhere? If not, are there any plans/issues for adding it, (but just super low priority)? Didn't want to reinvent the wheel here if I didn't have to.
k

Kenneth Wußmann

09/01/2020, 7:27 AM
Hey, something like that is not included. For how to auto-fill a created and updated timestamp you can look at this example: https://github.com/PaulMuriithi/ExposedDatesAutoFill/blob/master/src/main/kotlin/app/Models.kt And this pattern of a BaseEntity could also be used for a deleted column.
w

Wyatt Kennedy

09/02/2020, 3:59 AM
@Kenneth Wußmann didn't know about that EntityHook is that documented anywhere? Thanks, this does exactly what I need and that inheritance pattern is pretty great.
6 Views