jOOQ’s DAO extension plugin

I recently created a gradle plugin for myself to expand DAO in Spring Ecosystem, in order to be able to cover almost all the needs for using repositories using the generated DAO.

For the most part, I created it for my own projects, but I really liked the convenience and decided to share it, in case someone else would also be interested.

There’s library: https://github.com/vendelieu/jooq-extension

There’s small example of extended functions usage:

“` fun create(uuid: String): User = create { this.uuid = uuid }

fun get(uuid: String): User = getOne { USER.UUID.eq(uuid) } ?: create(uuid)

fun update(uuid: String, block: User.() -> Unit): User? = update(USER.UUID.eq(uuid), block)

fun countUsers() = count { USER.CREATED_AT.gt(Instant.now().minus(1.days)) }

“`

submitted by /u/vendelieu
[link] [comments]