Composition Test 1

This commit is contained in:
nova 2020-06-04 17:39:16 +05:30
parent b7716b980b
commit 097e5d1f01

View File

@ -6,6 +6,7 @@ import com.example.demo.model.test_db.Tables.MESSAGES
import com.example.demo.model.test_db.tables.Users.USERS import com.example.demo.model.test_db.tables.Users.USERS
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.asFlow import kotlinx.coroutines.flow.asFlow
import org.jooq.Condition
import org.jooq.DSLContext import org.jooq.DSLContext
import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Lazy import org.springframework.context.annotation.Lazy
@ -45,5 +46,15 @@ class UserService(@Autowired @Lazy private val dsl: DSLContext) {
.map { it.get(MESSAGES.MESSAGE) } .map { it.get(MESSAGES.MESSAGE) }
.asFlow() .asFlow()
fun test() = dsl
.select(Query.messages)
.from(MESSAGES)
.where(Query.complexClause)
.fetch()
.asFlow()
private object Query {
val messages = listOf(MESSAGES.MESSAGE)
val complexClause: Condition = MESSAGES.MESSAGE.eq("")
}
} }