Skip to content

Commit 385fd1d

Browse files
committed
Add pagination to SafeSql
1 parent 0262bc4 commit 385fd1d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

mug-safesql/src/main/java/com/google/mu/safesql/SafeSql.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,8 @@ public <T> Optional<T> queryForOne(
968968
/**
969969
* Paginate the encapsulated query by fetching up to {@code pageSize} rows for each page.
970970
*
971-
* <p>If {@code orderByKeys} is non-empty, the column values are used to control pagination.
971+
* <p>If {@code orderByKeys} is non-empty, they refer to the columns that must uniquely identify
972+
* a row. These column values are then used to control pagination.
972973
* For example, if {@code [groupId, timestamp]} can uniquely identify a row, the generated
973974
* SQL will use {@code "groupId" > ? OR ("groupId" = ? AND "timestamp" > ?)} for the next page,
974975
* comparing against the previous page's last row.
@@ -979,7 +980,7 @@ public <T> Optional<T> queryForOne(
979980
*
980981
* <p>The standard SQL {@code FETCH NEXT ROWS} syntax is used for pagination.
981982
* If {@code orderByKeys} is empty, the paginated query will use {@code OFFSET} keyword
982-
* to specify the next page offset.
983+
* instead of the sort key columns to specify the next page offset.
983984
*
984985
* <p>All column names are automatically double-quoted to avoid clashing with keywords or spaces
985986
* in identifiers. If your DB is case sensitive, make sure you pass in the accurate case.
@@ -1007,7 +1008,8 @@ public <T> Stream<List<T>> paginateLazily(
10071008
/**
10081009
* Paginate the encapsulated query by fetching up to {@code pageSize} rows for each page.
10091010
*
1010-
* <p>If {@code orderByKeys} is non-empty, the column values are used to control pagination.
1011+
* <p>If {@code orderByKeys} is non-empty, they refer to the columns that must uniquely identify
1012+
* a row. These column values are then used to control pagination.
10111013
* For example, if {@code [groupId, timestamp]} can uniquely identify a row, the generated
10121014
* SQL will use {@code "groupId" > ? OR ("groupId" = ? AND "timestamp" > ?)} for the next page,
10131015
* comparing against the previous page's last row.
@@ -1018,7 +1020,7 @@ public <T> Stream<List<T>> paginateLazily(
10181020
*
10191021
* <p>The standard SQL {@code FETCH NEXT ROWS} syntax is used for pagination.
10201022
* If {@code orderByKeys} is empty, the paginated query will use {@code OFFSET} keyword
1021-
* to specify the next page offset.
1023+
* instead of the sort key columns to specify the next page offset.
10221024
*
10231025
* <p>All column names are automatically double-quoted to avoid clashing with keywords or spaces
10241026
* in identifiers. If your DB is case sensitive, make sure you pass in the accurate case.
@@ -1049,7 +1051,8 @@ public <T> Stream<List<T>> paginateLazily(
10491051
/**
10501052
* Paginate the encapsulated query by fetching up to {@code pageSize} rows for each page.
10511053
*
1052-
* <p>If {@code orderByKeys} is non-empty, the column values are used to control pagination.
1054+
* <p>If {@code orderByKeys} is non-empty, they refer to the columns that must uniquely identify
1055+
* a row. These column values are then used to control pagination.
10531056
* For example, if {@code [groupId, timestamp]} can uniquely identify a row, the generated
10541057
* SQL will use {@code "groupId" > ? OR ("groupId" = ? AND "timestamp" > ?)} for the next page,
10551058
* comparing against the previous page's last row.
@@ -1060,7 +1063,7 @@ public <T> Stream<List<T>> paginateLazily(
10601063
*
10611064
* <p>The standard SQL {@code FETCH NEXT ROWS} syntax is used for pagination.
10621065
* If {@code orderByKeys} is empty, the paginated query will use {@code OFFSET} keyword
1063-
* to specify the next page offset.
1066+
* instead of the sort key columns to specify the next page offset.
10641067
*
10651068
* <p>All column names are automatically double-quoted to avoid clashing with keywords or spaces
10661069
* in identifiers. If your DB is case sensitive, make sure you pass in the accurate case.
@@ -1088,7 +1091,8 @@ public <T> Stream<List<T>> paginateLazily(
10881091
/**
10891092
* Paginate the encapsulated query by fetching up to {@code pageSize} rows for each page.
10901093
*
1091-
* <p>If {@code orderByKeys} is non-empty, the column values are used to control pagination.
1094+
* <p>If {@code orderByKeys} is non-empty, they refer to the columns that must uniquely identify
1095+
* a row. These column values are then used to control pagination.
10921096
* For example, if {@code [groupId, timestamp]} can uniquely identify a row, the generated
10931097
* SQL will use {@code "groupId" > ? OR ("groupId" = ? AND "timestamp" > ?)} for the next page,
10941098
* comparing against the previous page's last row.
@@ -1099,7 +1103,7 @@ public <T> Stream<List<T>> paginateLazily(
10991103
*
11001104
* <p>The standard SQL {@code FETCH NEXT ROWS} syntax is used for pagination.
11011105
* If {@code orderByKeys} is empty, the paginated query will use {@code OFFSET} keyword
1102-
* to specify the next page offset.
1106+
* instead of the sort key columns to specify the next page offset.
11031107
*
11041108
* <p>All column names are automatically double-quoted to avoid clashing with keywords or spaces
11051109
* in identifiers. If your DB is case sensitive, make sure you pass in the accurate case.

0 commit comments

Comments
 (0)