File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed
src/test/kotlin/examples/kotlin/spring/canonical Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,9 @@ import java.util.*
19
19
20
20
data class LastName (val name : String )
21
21
22
- fun lastNameConverter ( source : LastName ? ) = source ?.name
22
+ val lastNameConverter: ( LastName ? ) -> String? = { it ?.name }
23
23
24
- fun booleanToStringConverter (source : Boolean? ): String {
25
- fun Boolean.asString () = if (this ) " Yes" else " No"
26
- return source?.asString()? : " No"
27
- }
24
+ val booleanToStringConverter: (Boolean? ) -> String = { it?.let { if (it) " Yes" else " No" } ? : " No" }
28
25
29
26
data class PersonRecord (
30
27
var id : Int? = null ,
@@ -59,7 +56,7 @@ data class AddressRecord(
59
56
var state : String? = null
60
57
)
61
58
62
- data class GeneratedAlwaysRecord (
59
+ data class GeneratedAlwaysRecord (
63
60
var id : Int? = null ,
64
61
var firstName : String? = null ,
65
62
var lastName : String? = null ,
Original file line number Diff line number Diff line change @@ -24,10 +24,10 @@ object PersonDynamicSqlSupport {
24
24
val id = column<Int >(" id" , JDBCType .INTEGER )
25
25
val firstName = column<String >(" first_name" , JDBCType .VARCHAR )
26
26
val lastName = column<LastName >(" last_name" , JDBCType .VARCHAR )
27
- .withParameterTypeConverter(:: lastNameConverter)
27
+ .withParameterTypeConverter(lastNameConverter)
28
28
val birthDate = column<Date >(" birth_date" , JDBCType .DATE )
29
29
val employed = column<Boolean >(" employed" , JDBCType .VARCHAR )
30
- .withParameterTypeConverter(:: booleanToStringConverter)
30
+ .withParameterTypeConverter(booleanToStringConverter)
31
31
val occupation = column<String >(" occupation" , JDBCType .VARCHAR )
32
32
val addressId = column<Int >(" address_id" , JDBCType .INTEGER )
33
33
}
You can’t perform that action at this time.
0 commit comments