You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 20, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,9 @@ Also, it supports the default arguments which are peculiar to `Kotlin`.
103
103
Also, by default, `KRowMapper` compares argument names and column names to see if they correspond.
104
104
Therefore, in the case of "argument name is `camelCase` and column name is `snake_case`", it is necessary to pass a function that appropriately converts the naming convention of the argument name.
105
105
106
+
You can also pass a `ConversionService` for value conversion if needed.
107
+
If you don't pass it, `DefaultConversionService.sharedInstance` will be used as default.
108
+
106
109
### Initialization from method reference(KFunction)
107
110
You can initialize `KRowMapper` from `method reference(KFunction)` as follows It is.
108
111
@@ -235,13 +238,16 @@ By using the contents described so far, you can perform more flexible and safe m
235
238
In addition, by making full use of the abundant functions provided by `KRowMapper`, further labor saving is possible.
236
239
237
240
### Deserialization
238
-
Since `KRowMapper` gets the value from `java.sql.ResultSet`, by default it is not possible to get the type which is not supported by this implementation.
239
-
To deal with this problem, `KRowMapper` provides the following three types of deserialization methods in addition to the default conversion function.
241
+
`KRowMapper` supports deserialization using the `ConversionService` (`DefaultConversionService.sharedInstance` by default).
242
+
243
+
In addition to this, as a more explicit and flexible deserialization method, `KRowMapper` provides the following three deserialization methods.
240
244
241
245
1. Deserialization by using the `KColumnDeserializer` annotation.
242
246
2. Deserialization by creating your own custom deserialization annotations.
243
247
3. Deserialization from multiple arguments.
244
248
249
+
These deserialization methods take precedence over deserialization by `ConversionService`.
250
+
245
251
#### Deserialization by using the KColumnDeserializer annotation
246
252
If it is a self-made class and can be initialized from a single argument, deserialization using the `KColumnDeserializer` annotation can be used.
247
253
`KColumnDeserializer` annotation can be used to `constructor` or `factory method` defined in `companion object`.
@@ -481,6 +487,3 @@ class Foo(
481
487
valdescription:String = ""
482
488
)
483
489
```
484
-
485
-
#### Deserialize Enum
486
-
If the value stored in the DB and the `Enum::name` property of the map destination are the same, it will be automatically converted to You can deserialize the `Enum`.
0 commit comments