Skip to content

Commit cb94a8d

Browse files
pangolingosoedirgo
andauthored
docs: improve tsdoc for the range() method (#439)
* 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]>
1 parent aeb2ce9 commit cb94a8d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/PostgrestTransformBuilder.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ export default class PostgrestTransformBuilder<
101101
}
102102

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

0 commit comments

Comments
 (0)