Skip to content

Commit

Permalink
docs: improve tsdoc for the range() method (#439)
Browse files Browse the repository at this point in the history
* Documentation improvements for the `range()` method

These updates are based on feedback in issue #15222 (supabase/supabase#15222)

The original docs state that "range" takes a starting index and ending index and returns the values between them. This implies that it's using the primary ID. But it actually works more like limit + offset.

---------

Co-authored-by: Bobbie Soedirgo <[email protected]>
  • Loading branch information
pangolingo and soedirgo authored Jun 23, 2023
1 parent aeb2ce9 commit cb94a8d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/PostgrestTransformBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ export default class PostgrestTransformBuilder<
}

/**
* Limit the query result by `from` and `to` inclusively.
* Limit the query result by starting at an offset (`from`) and ending at the offset (`from + to`).
* Only records within this range are returned.
* This respects the query order and if there is no order clause the range could behave unexpectedly.
* The `from` and `to` values are 0-based and inclusive: `range(1, 3)` will include the second, third
* and fourth rows of the query.
*
* @param from - The starting index from which to limit the result
* @param to - The last index to which to limit the result
Expand Down

0 comments on commit cb94a8d

Please sign in to comment.