https://kotlinlang.org logo
#exposed
Title
# exposed
w

Wyatt Kennedy

10/27/2020, 3:15 AM
Hey, is there some way to attach data to the transaction when it is started that I could access within an EntityHook? I'd like to make a function like
userTransaction(userId: Long, db: Database? = null, statement: Transaction.() -> T)
, but I can't find anywhere to store data on the Transaction object, or any way to subclass transaction and use that. Any suggestions?
Lol, after nosing around in the exposed code a bit, I found the UserDataHolder object that appears to be for this exact purpose. I'll make a PR for the wiki documentation to add a blurb on the Transaction page about it.
t

tapac

11/11/2020, 7:14 AM
@Wyatt Kennedy There is also TransactionStore delegate which could be used as:
Copy code
var transactionValue by transactionScope { defaultValue }
4 Views