Took some JDBC wrapper code I've been using for a ...
# exposed
f
Took some JDBC wrapper code I've been using for a work project and have been simmering it down and Kotlinizing it, just to see what kind of neat things I could make it do. Finally boiled our (very utilitarian) syntax for a reusable
ResultSet
model mapper to look like this in use:
Copy code
val transformer = (
    ResultSetRowTransformer
        createdBy { MyRecord() }
        string "MY_STRING_A" bindsTo MyRecord::propertyA
        integer "MY_INTEGER_B" bindsTo MyRecord::setThingB
        toggle "MY_BOOLEAN_C" whenTrue MyRecord::turnOnC whenFalse MyRecord::turnOffC
        integer "MY_INTEGER_D" via { "$it" } bindsTo MyRecord::stringPropertyD )