Currently what I need to do is
dataSource.connection.use { connection ->
NormQuery().query(
connection,
NormParams(param1=value1, param2=value2, paramN=valueN)
)
}
So here basically I manually need to use connection and NormParams for passing parameters to the query.
If we declare method like
fun <P, R : Any> DataSource.runQuery(query: Query<P, R>, params: P.() -> Unit): R {
val result = ... // Get result data class
return result
}
Then we can use Norm generated classes like...
fun addSomething() {
val result = dataSource.runQuery(NormQuery()) {
param1 = value1
param2 = value2
paramN = valueN
}
}
Here param and response result will be generic.
Currently what I need to do is
dataSource.connection.use { connection -> NormQuery().query( connection, NormParams(param1=value1, param2=value2, paramN=valueN) ) }So here basically I manually need to use
connectionandNormParamsfor passing parameters to the query.If we declare method like
Then we can use Norm generated classes like...
Here param and response result will be generic.