Re: on update only annotation (life cycle callbacks ?)

282 views
Skip to first unread message

Maxime Lévesque

unread,
Aug 24, 2011, 6:34:20 AM8/24/11
to squ...@googlegroups.com

There's a beta feature in the master branch, for now the test case is the only documentation there is :

   https://github.com/max-l/Squeryl/commit/dca334e3763e4586c5b3ed53b172854f97d1de49#L4R209

if you want to update the time field before every update on a table you do :

override def callbacks = Seq(
beforeUpdate(yourTableOfA) call(_.updateTime = System.currentTimeMillis),
)

if you want to do it on all persistent types that extend a common ancestor type, you would do :

override def callbacks = Seq(
beforeUpdate[YourAncestorType] call(_.updateTime = System.currentTimeMillis),
)

ML

2011/8/24 Babel <chp...@gmail.com>
Hello

I have a working schema to store contacts which I need to batch. I've
noticed the insertOrUpdate method that should be very useful but I
need to store the updateTime only on updates. Do someone already got
this problem? I had a look on squeryl schema and went through all the
documentation without finding the solution which does not seems so
unusual (probably my fault)

Many thanks in advance for any help

ÆtherSurfer

unread,
Jan 17, 2017, 6:10:06 PM1/17/17
to Squeryl
Doesn't this require the updateTime field to be a var?
Reply all
Reply to author
Forward
0 new messages