Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Cyan Ho <[email protected]>
  • Loading branch information
tadeboro and pilagod authored May 29, 2024
1 parent a45711b commit 152db2b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ Default options used by paginator when not specified:
- `Order`: `paginator.DESC`
- `TupleCmp`: `paginator.DISABLED`
- `AllowTupleCmp`: `paginator.FALSE`
When cursor uses more than one key/rule, paginator instances by default generate SQL that is compatible with almost all database management systems. But this query can be very inefficient and can result in a lot of database scans even when proper indices are in place. By enabling the `TupleCmp` option, paginator will emit a slightly different SQL query when all cursor keys are ordered in the same way.
When cursor uses more than one key/rule, paginator instances by default generate SQL that is compatible with almost all database management systems. But this query can be very inefficient and can result in a lot of database scans even when proper indices are in place. By enabling the `AllowTupleCmp` option, paginator will emit a slightly different SQL query when all cursor keys are ordered in the same way.
For example, let us assume we have the following code:
Expand Down Expand Up @@ -222,7 +222,7 @@ paginator.New(
paginator.WithKeys([]string{"CreatedAt", "ID"}),
paginator.WithAfter(after),
paginator.WithLimit(3),
paginator.WithTupleCmp(paginate.ENABLED),
paginator.WithAllowTupleCmp(paginate.TRUE),
).Paginate(db, &result)
```
Expand Down

0 comments on commit 152db2b

Please sign in to comment.