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
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -399,12 +399,12 @@ The `mapColumns` function is used to obtain the results of a column:
399
399
val names = database.employees.mapColumns { it.name }
400
400
```
401
401
402
-
Additionally, if we want to select two or more columns, we can change to `mapColumns2` or `mapColumns3`, then we need to wrap our selected columns by `Pair` or `Triple`in the closure, and the function’s return type becomes `List<Pair<C1?, C2?>>` or `List<Triple<C1?, C2?, C3?>>`.
402
+
Additionally, if we want to select two or more columns, we just need to wrap our selected columns by `tupleOf`in the closure, and the function’s return type becomes `List<TupleN<C1?, C2?, .. Cn?>>`.
403
403
404
404
```kotlin
405
405
database.employees
406
406
.filter { it.departmentId eq 1 }
407
-
.mapColumns2 { Pair(it.id, it.name) }
407
+
.mapColumns { tupleOf(it.id, it.name) }
408
408
.forEach { (id, name) ->
409
409
println("$id:$name")
410
410
}
@@ -436,12 +436,12 @@ val max = database.employees
436
436
.aggregateColumns { max(it.salary) }
437
437
```
438
438
439
-
Also, if we want to aggregate two or more columns, we can change to `aggregateColumns2` or `aggregateColumns3`, then we need to wrap our aggregate expressions by `Pair` or `Triple`in the closure, and the function’s return type becomes `Pair<C1?, C2?>` or `Triple<C1?, C2?, C3?>`. The example below obtains the average and the range of salaries in department 1:
439
+
Also, if we want to aggregate two or more columns, we just need to wrap our aggregate expressions by `tupleOf`in the closure, and the function’s return type becomes `TupleN<C1?, C2?, .. Cn?>`. The example below obtains the average and the range of salaries in department 1:
0 commit comments