@@ -443,27 +443,27 @@ data class Foo(
443
443
444
444
The transformation of the argument name is also applied to the alias set by ` KParameterAlias ` .
445
445
446
- ### Use default arguments
447
- ` KRowMapper ` supports ` default arguments ` .
448
- ` Default arguments ` are available in the following situations:
446
+ #### Use default arguments
447
+ The ` KRowMapper ` allows you to use default arguments in certain situations.
449
448
450
- - When not referring to the acquisition result
451
- - When the acquisition result is ` null `
452
-
453
- As of ` KRowMapper ` 0.8, it does not support the use of ` default argument ` when columns cannot be obtained.
454
-
455
- #### When not referring to the acquisition result
456
- When the ` KUseDefaultArgument ` ` annotation ` is added to the parameter,
457
- the ` default argument ` can be used forcibly without referring to the obtained result.
449
+ ##### Always use the default arguments
450
+ If you don't want to use the value from the DB and always use the default argument, you can use the ` KUseDefaultArgument ` annotation.
458
451
459
452
``` kotlin
460
- data class Dst (val fooId : Int , @param:KUseDefaultArgument val barValue : String = " default" )
453
+ class Foo (
454
+ ...,
455
+ @KUseDefaultArgument
456
+ val description : String = " "
457
+ )
461
458
```
462
459
463
- #### When the acquisition result is null
464
- When ` KParameterRequireNonNull ` ` annotation ` is given to a parameter,
465
- the default argument can be used if the obtained result is ` null ` .
460
+ ##### Use default argument if the result is null
461
+ If you want to use the default argument if the result is ` null ` , you can use the ` KParameterRequireNonNull ` annotation.
466
462
467
463
``` kotlin
468
- data class Dst (val fooId : Int , @param:KParameterRequireNonNull val barValue : String = " default" )
464
+ class Foo (
465
+ ...,
466
+ @KParameterRequireNonNull
467
+ val description : String = " "
468
+ )
469
469
```
0 commit comments