Skip to content

Commit

Permalink
fix(bunpaginate): with column
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Sep 23, 2024
1 parent 899f116 commit 56ccb75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bun/bunpaginate/pagination_column.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func UsingColumn[FILTERS any, ENTITY any](ctx context.Context,
query ColumnPaginatedQuery[FILTERS]) (*Cursor[ENTITY], error) {
ret := make([]ENTITY, 0)

sb = sb.Model(&ret)
sb = sb.Limit(int(query.PageSize) + 1) // Fetch one additional item to find the next token
order := query.Order
if query.Reverse {
Expand All @@ -42,7 +43,7 @@ func UsingColumn[FILTERS any, ENTITY any](ctx context.Context,
}
}

if err := sb.Scan(ctx, &ret); err != nil {
if err := sb.Scan(ctx); err != nil {
return nil, err
}

Expand Down

0 comments on commit 56ccb75

Please sign in to comment.