This repository was archived by the owner on Jan 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Expand file tree Collapse file tree 1 file changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -423,6 +423,26 @@ Here's a quick look at how to deserialize the content so far.
423
423
- Use the ` constructor ` or ` factory methods ` to perform the conversion.
424
424
- Use ` KParameterFlatten ` annotation.
425
425
426
+ ### Other Features
427
+ #### Adding an alias to argument names
428
+ There is a case where the name of the argument and the column name are different as follows.
429
+
430
+ ``` kotlin
431
+ // The argument "id" is defined in the DB as "foo_id".
432
+ data class Foo (val id : Int )
433
+ ```
434
+
435
+ In such a case, the ` KParameterAlias ` annotation is used to make the mapping according to the column name on the DB.
436
+
437
+ ``` kotlin
438
+ data class Foo (
439
+ @param:KParameterAlias("fooId")
440
+ val id : Int
441
+ )
442
+ ```
443
+
444
+ The transformation of the argument name is also applied to the alias set by ` KParameterAlias ` .
445
+
426
446
### Use default arguments
427
447
` KRowMapper ` supports ` default arguments ` .
428
448
` Default arguments ` are available in the following situations:
@@ -447,11 +467,3 @@ When `KParameterRequireNonNull` `annotation` is given to a parameter,
447
467
``` kotlin
448
468
data class Dst (val fooId : Int , @param:KParameterRequireNonNull val barValue : String = " default" )
449
469
```
450
-
451
- ### Parameter aliasing
452
- In ` KRowMapper ` , the column name of the acquisition target can be specified by giving the ` KParameterAlias ` ` annotation ` to the ` parameter ` .
453
- The name conversion function is applied to the name specified here.
454
-
455
- ``` kotlin
456
- data class Dst (@param:KParameterAlias("fooId") val barValue : Int )
457
- ```
You can’t perform that action at this time.
0 commit comments