@supabase/postgrest-js 2.108.2 → 2.108.3-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +96 -1376
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1427 -112
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1427 -112
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +96 -1376
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PostgrestClient.ts +13 -19
- package/src/PostgrestFilterBuilder.ts +100 -84
- package/src/PostgrestTransformBuilder.ts +19 -0
- package/src/version.ts +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1125,6 +1125,25 @@ declare class PostgrestTransformBuilder<ClientOptions extends ClientServerOption
|
|
|
1125
1125
|
* ```
|
|
1126
1126
|
*/
|
|
1127
1127
|
select<Query extends string = '*', NewResultOne = GetResult<Schema, Row, RelationName, Relationships, Query, ClientOptions>>(columns?: Query): PostgrestFilterBuilder<ClientOptions, Schema, Row, Method extends 'RPC' ? Result$1 extends unknown[] ? NewResultOne[] : NewResultOne : NewResultOne[], RelationName, Relationships, Method, ThrowOnError>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Order the query result by `column`.
|
|
1130
|
+
*
|
|
1131
|
+
* You can call this method multiple times to order by multiple columns.
|
|
1132
|
+
*
|
|
1133
|
+
* You can order referenced tables, but it only affects the ordering of the
|
|
1134
|
+
* parent table if you use `!inner` in the query.
|
|
1135
|
+
*
|
|
1136
|
+
* @param column - The column to order by
|
|
1137
|
+
* @param options - Named parameters
|
|
1138
|
+
* @param options.ascending - If `true`, the result will be in ascending order
|
|
1139
|
+
* @param options.nullsFirst - If `true`, `null`s appear first. If `false`,
|
|
1140
|
+
* `null`s appear last.
|
|
1141
|
+
* @param options.referencedTable - Set this to order a referenced table by
|
|
1142
|
+
* its columns
|
|
1143
|
+
*
|
|
1144
|
+
* @category Database
|
|
1145
|
+
* @subcategory Using modifiers
|
|
1146
|
+
*/
|
|
1128
1147
|
order<ColumnName extends string & keyof Row>(column: ColumnName, options?: {
|
|
1129
1148
|
ascending?: boolean;
|
|
1130
1149
|
nullsFirst?: boolean;
|
|
@@ -1744,23 +1763,1195 @@ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions,
|
|
|
1744
1763
|
* @exampleSql With `select()`
|
|
1745
1764
|
* ```sql
|
|
1746
1765
|
* create table
|
|
1747
|
-
* characters (id int8 primary key, name text);
|
|
1766
|
+
* characters (id int8 primary key, name text);
|
|
1767
|
+
*
|
|
1768
|
+
* insert into
|
|
1769
|
+
* characters (id, name)
|
|
1770
|
+
* values
|
|
1771
|
+
* (1, 'Luke'),
|
|
1772
|
+
* (2, 'Leia'),
|
|
1773
|
+
* (3, 'Han');
|
|
1774
|
+
* ```
|
|
1775
|
+
*
|
|
1776
|
+
* @exampleResponse With `select()`
|
|
1777
|
+
* ```json
|
|
1778
|
+
* {
|
|
1779
|
+
* "data": [
|
|
1780
|
+
* {
|
|
1781
|
+
* "id": 2,
|
|
1782
|
+
* "name": "Leia"
|
|
1783
|
+
* }
|
|
1784
|
+
* ],
|
|
1785
|
+
* "status": 200,
|
|
1786
|
+
* "statusText": "OK"
|
|
1787
|
+
* }
|
|
1788
|
+
* ```
|
|
1789
|
+
*/
|
|
1790
|
+
eq<ColumnName extends string>(column: ColumnName extends keyof Row ? ColumnName : ColumnName extends `${string}.${string}` | `${string}->${string}` ? ColumnName : string extends ColumnName ? string : keyof Row, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? NonNullable<unknown> : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? NonNullable<ResolvedFilterValue> : never): this;
|
|
1791
|
+
/**
|
|
1792
|
+
* Match only rows where `column` is not equal to `value`.
|
|
1793
|
+
*
|
|
1794
|
+
* This filter does not include rows where `column` is `NULL`. To match null
|
|
1795
|
+
* values, use `.is(column, null)` instead.
|
|
1796
|
+
*
|
|
1797
|
+
* @param column - The column to filter on
|
|
1798
|
+
* @param value - The value to filter with
|
|
1799
|
+
*
|
|
1800
|
+
* @category Database
|
|
1801
|
+
* @subcategory Using filters
|
|
1802
|
+
*
|
|
1803
|
+
* @example With `select()`
|
|
1804
|
+
* ```ts
|
|
1805
|
+
* const { data, error } = await supabase
|
|
1806
|
+
* .from('characters')
|
|
1807
|
+
* .select()
|
|
1808
|
+
* .neq('name', 'Leia')
|
|
1809
|
+
* ```
|
|
1810
|
+
*
|
|
1811
|
+
* @exampleSql With `select()`
|
|
1812
|
+
* ```sql
|
|
1813
|
+
* create table
|
|
1814
|
+
* characters (id int8 primary key, name text);
|
|
1815
|
+
*
|
|
1816
|
+
* insert into
|
|
1817
|
+
* characters (id, name)
|
|
1818
|
+
* values
|
|
1819
|
+
* (1, 'Luke'),
|
|
1820
|
+
* (2, 'Leia'),
|
|
1821
|
+
* (3, 'Han');
|
|
1822
|
+
* ```
|
|
1823
|
+
*
|
|
1824
|
+
* @exampleResponse With `select()`
|
|
1825
|
+
* ```json
|
|
1826
|
+
* {
|
|
1827
|
+
* "data": [
|
|
1828
|
+
* {
|
|
1829
|
+
* "id": 1,
|
|
1830
|
+
* "name": "Luke"
|
|
1831
|
+
* },
|
|
1832
|
+
* {
|
|
1833
|
+
* "id": 3,
|
|
1834
|
+
* "name": "Han"
|
|
1835
|
+
* }
|
|
1836
|
+
* ],
|
|
1837
|
+
* "status": 200,
|
|
1838
|
+
* "statusText": "OK"
|
|
1839
|
+
* }
|
|
1840
|
+
* ```
|
|
1841
|
+
*/
|
|
1842
|
+
neq<ColumnName extends string>(column: ColumnName extends keyof Row ? ColumnName : ColumnName extends `${string}.${string}` | `${string}->${string}` ? ColumnName : string extends ColumnName ? string : keyof Row, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer Resolved ? Resolved : never): this;
|
|
1843
|
+
/**
|
|
1844
|
+
* Match only rows where `column` is greater than `value`.
|
|
1845
|
+
*
|
|
1846
|
+
* @param column - The column to filter on
|
|
1847
|
+
* @param value - The value to filter with
|
|
1848
|
+
*
|
|
1849
|
+
* @category Database
|
|
1850
|
+
* @subcategory Using filters
|
|
1851
|
+
*
|
|
1852
|
+
* @exampleDescription With `select()`
|
|
1853
|
+
* When using [reserved words](https://www.postgresql.org/docs/current/sql-keywords-appendix.html) for column names you need
|
|
1854
|
+
* to add double quotes e.g. `.gt('"order"', 2)`
|
|
1855
|
+
*
|
|
1856
|
+
* @example With `select()`
|
|
1857
|
+
* ```ts
|
|
1858
|
+
* const { data, error } = await supabase
|
|
1859
|
+
* .from('characters')
|
|
1860
|
+
* .select()
|
|
1861
|
+
* .gt('id', 2)
|
|
1862
|
+
* ```
|
|
1863
|
+
*
|
|
1864
|
+
* @exampleSql With `select()`
|
|
1865
|
+
* ```sql
|
|
1866
|
+
* create table
|
|
1867
|
+
* characters (id int8 primary key, name text);
|
|
1868
|
+
*
|
|
1869
|
+
* insert into
|
|
1870
|
+
* characters (id, name)
|
|
1871
|
+
* values
|
|
1872
|
+
* (1, 'Luke'),
|
|
1873
|
+
* (2, 'Leia'),
|
|
1874
|
+
* (3, 'Han');
|
|
1875
|
+
* ```
|
|
1876
|
+
*
|
|
1877
|
+
* @exampleResponse With `select()`
|
|
1878
|
+
* ```json
|
|
1879
|
+
* {
|
|
1880
|
+
* "data": [
|
|
1881
|
+
* {
|
|
1882
|
+
* "id": 3,
|
|
1883
|
+
* "name": "Han"
|
|
1884
|
+
* }
|
|
1885
|
+
* ],
|
|
1886
|
+
* "status": 200,
|
|
1887
|
+
* "statusText": "OK"
|
|
1888
|
+
* }
|
|
1889
|
+
* ```
|
|
1890
|
+
*/
|
|
1891
|
+
gt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1892
|
+
gt(column: string, value: unknown): this;
|
|
1893
|
+
/**
|
|
1894
|
+
* Match only rows where `column` is greater than or equal to `value`.
|
|
1895
|
+
*
|
|
1896
|
+
* @param column - The column to filter on
|
|
1897
|
+
* @param value - The value to filter with
|
|
1898
|
+
*
|
|
1899
|
+
* @category Database
|
|
1900
|
+
* @subcategory Using filters
|
|
1901
|
+
*
|
|
1902
|
+
* @example With `select()`
|
|
1903
|
+
* ```ts
|
|
1904
|
+
* const { data, error } = await supabase
|
|
1905
|
+
* .from('characters')
|
|
1906
|
+
* .select()
|
|
1907
|
+
* .gte('id', 2)
|
|
1908
|
+
* ```
|
|
1909
|
+
*
|
|
1910
|
+
* @exampleSql With `select()`
|
|
1911
|
+
* ```sql
|
|
1912
|
+
* create table
|
|
1913
|
+
* characters (id int8 primary key, name text);
|
|
1914
|
+
*
|
|
1915
|
+
* insert into
|
|
1916
|
+
* characters (id, name)
|
|
1917
|
+
* values
|
|
1918
|
+
* (1, 'Luke'),
|
|
1919
|
+
* (2, 'Leia'),
|
|
1920
|
+
* (3, 'Han');
|
|
1921
|
+
* ```
|
|
1922
|
+
*
|
|
1923
|
+
* @exampleResponse With `select()`
|
|
1924
|
+
* ```json
|
|
1925
|
+
* {
|
|
1926
|
+
* "data": [
|
|
1927
|
+
* {
|
|
1928
|
+
* "id": 2,
|
|
1929
|
+
* "name": "Leia"
|
|
1930
|
+
* },
|
|
1931
|
+
* {
|
|
1932
|
+
* "id": 3,
|
|
1933
|
+
* "name": "Han"
|
|
1934
|
+
* }
|
|
1935
|
+
* ],
|
|
1936
|
+
* "status": 200,
|
|
1937
|
+
* "statusText": "OK"
|
|
1938
|
+
* }
|
|
1939
|
+
* ```
|
|
1940
|
+
*/
|
|
1941
|
+
gte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1942
|
+
gte(column: string, value: unknown): this;
|
|
1943
|
+
/**
|
|
1944
|
+
* Match only rows where `column` is less than `value`.
|
|
1945
|
+
*
|
|
1946
|
+
* @param column - The column to filter on
|
|
1947
|
+
* @param value - The value to filter with
|
|
1948
|
+
*
|
|
1949
|
+
* @category Database
|
|
1950
|
+
* @subcategory Using filters
|
|
1951
|
+
*
|
|
1952
|
+
* @example With `select()`
|
|
1953
|
+
* ```ts
|
|
1954
|
+
* const { data, error } = await supabase
|
|
1955
|
+
* .from('characters')
|
|
1956
|
+
* .select()
|
|
1957
|
+
* .lt('id', 2)
|
|
1958
|
+
* ```
|
|
1959
|
+
*
|
|
1960
|
+
* @exampleSql With `select()`
|
|
1961
|
+
* ```sql
|
|
1962
|
+
* create table
|
|
1963
|
+
* characters (id int8 primary key, name text);
|
|
1964
|
+
*
|
|
1965
|
+
* insert into
|
|
1966
|
+
* characters (id, name)
|
|
1967
|
+
* values
|
|
1968
|
+
* (1, 'Luke'),
|
|
1969
|
+
* (2, 'Leia'),
|
|
1970
|
+
* (3, 'Han');
|
|
1971
|
+
* ```
|
|
1972
|
+
*
|
|
1973
|
+
* @exampleResponse With `select()`
|
|
1974
|
+
* ```json
|
|
1975
|
+
* {
|
|
1976
|
+
* "data": [
|
|
1977
|
+
* {
|
|
1978
|
+
* "id": 1,
|
|
1979
|
+
* "name": "Luke"
|
|
1980
|
+
* }
|
|
1981
|
+
* ],
|
|
1982
|
+
* "status": 200,
|
|
1983
|
+
* "statusText": "OK"
|
|
1984
|
+
* }
|
|
1985
|
+
* ```
|
|
1986
|
+
*/
|
|
1987
|
+
lt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1988
|
+
lt(column: string, value: unknown): this;
|
|
1989
|
+
/**
|
|
1990
|
+
* Match only rows where `column` is less than or equal to `value`.
|
|
1991
|
+
*
|
|
1992
|
+
* @param column - The column to filter on
|
|
1993
|
+
* @param value - The value to filter with
|
|
1994
|
+
*
|
|
1995
|
+
* @category Database
|
|
1996
|
+
* @subcategory Using filters
|
|
1997
|
+
*
|
|
1998
|
+
* @example With `select()`
|
|
1999
|
+
* ```ts
|
|
2000
|
+
* const { data, error } = await supabase
|
|
2001
|
+
* .from('characters')
|
|
2002
|
+
* .select()
|
|
2003
|
+
* .lte('id', 2)
|
|
2004
|
+
* ```
|
|
2005
|
+
*
|
|
2006
|
+
* @exampleSql With `select()`
|
|
2007
|
+
* ```sql
|
|
2008
|
+
* create table
|
|
2009
|
+
* characters (id int8 primary key, name text);
|
|
2010
|
+
*
|
|
2011
|
+
* insert into
|
|
2012
|
+
* characters (id, name)
|
|
2013
|
+
* values
|
|
2014
|
+
* (1, 'Luke'),
|
|
2015
|
+
* (2, 'Leia'),
|
|
2016
|
+
* (3, 'Han');
|
|
2017
|
+
* ```
|
|
2018
|
+
*
|
|
2019
|
+
* @exampleResponse With `select()`
|
|
2020
|
+
* ```json
|
|
2021
|
+
* {
|
|
2022
|
+
* "data": [
|
|
2023
|
+
* {
|
|
2024
|
+
* "id": 1,
|
|
2025
|
+
* "name": "Luke"
|
|
2026
|
+
* },
|
|
2027
|
+
* {
|
|
2028
|
+
* "id": 2,
|
|
2029
|
+
* "name": "Leia"
|
|
2030
|
+
* }
|
|
2031
|
+
* ],
|
|
2032
|
+
* "status": 200,
|
|
2033
|
+
* "statusText": "OK"
|
|
2034
|
+
* }
|
|
2035
|
+
* ```
|
|
2036
|
+
*/
|
|
2037
|
+
lte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
2038
|
+
lte(column: string, value: unknown): this;
|
|
2039
|
+
/**
|
|
2040
|
+
* Match only rows where `column` matches `pattern` case-sensitively.
|
|
2041
|
+
*
|
|
2042
|
+
* @param column - The column to filter on
|
|
2043
|
+
* @param pattern - The pattern to match with
|
|
2044
|
+
*
|
|
2045
|
+
* @category Database
|
|
2046
|
+
* @subcategory Using filters
|
|
2047
|
+
*
|
|
2048
|
+
* @example With `select()`
|
|
2049
|
+
* ```ts
|
|
2050
|
+
* const { data, error } = await supabase
|
|
2051
|
+
* .from('characters')
|
|
2052
|
+
* .select()
|
|
2053
|
+
* .like('name', '%Lu%')
|
|
2054
|
+
* ```
|
|
2055
|
+
*
|
|
2056
|
+
* @exampleSql With `select()`
|
|
2057
|
+
* ```sql
|
|
2058
|
+
* create table
|
|
2059
|
+
* characters (id int8 primary key, name text);
|
|
2060
|
+
*
|
|
2061
|
+
* insert into
|
|
2062
|
+
* characters (id, name)
|
|
2063
|
+
* values
|
|
2064
|
+
* (1, 'Luke'),
|
|
2065
|
+
* (2, 'Leia'),
|
|
2066
|
+
* (3, 'Han');
|
|
2067
|
+
* ```
|
|
2068
|
+
*
|
|
2069
|
+
* @exampleResponse With `select()`
|
|
2070
|
+
* ```json
|
|
2071
|
+
* {
|
|
2072
|
+
* "data": [
|
|
2073
|
+
* {
|
|
2074
|
+
* "id": 1,
|
|
2075
|
+
* "name": "Luke"
|
|
2076
|
+
* }
|
|
2077
|
+
* ],
|
|
2078
|
+
* "status": 200,
|
|
2079
|
+
* "statusText": "OK"
|
|
2080
|
+
* }
|
|
2081
|
+
* ```
|
|
2082
|
+
*/
|
|
2083
|
+
like<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
2084
|
+
like(column: string, pattern: string): this;
|
|
2085
|
+
/**
|
|
2086
|
+
* Match only rows where `column` matches all of `patterns` case-sensitively.
|
|
2087
|
+
*
|
|
2088
|
+
* @param column - The column to filter on
|
|
2089
|
+
* @param patterns - The patterns to match with
|
|
2090
|
+
*
|
|
2091
|
+
* @category Database
|
|
2092
|
+
* @subcategory Using filters
|
|
2093
|
+
*/
|
|
2094
|
+
likeAllOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
2095
|
+
likeAllOf(column: string, patterns: readonly string[]): this;
|
|
2096
|
+
/**
|
|
2097
|
+
* Match only rows where `column` matches any of `patterns` case-sensitively.
|
|
2098
|
+
*
|
|
2099
|
+
* @param column - The column to filter on
|
|
2100
|
+
* @param patterns - The patterns to match with
|
|
2101
|
+
*
|
|
2102
|
+
* @category Database
|
|
2103
|
+
* @subcategory Using filters
|
|
2104
|
+
*/
|
|
2105
|
+
likeAnyOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
2106
|
+
likeAnyOf(column: string, patterns: readonly string[]): this;
|
|
2107
|
+
/**
|
|
2108
|
+
* Match only rows where `column` matches `pattern` case-insensitively.
|
|
2109
|
+
*
|
|
2110
|
+
* @param column - The column to filter on
|
|
2111
|
+
* @param pattern - The pattern to match with
|
|
2112
|
+
*
|
|
2113
|
+
* @category Database
|
|
2114
|
+
* @subcategory Using filters
|
|
2115
|
+
*
|
|
2116
|
+
* @example With `select()`
|
|
2117
|
+
* ```ts
|
|
2118
|
+
* const { data, error } = await supabase
|
|
2119
|
+
* .from('characters')
|
|
2120
|
+
* .select()
|
|
2121
|
+
* .ilike('name', '%lu%')
|
|
2122
|
+
* ```
|
|
2123
|
+
*
|
|
2124
|
+
* @exampleSql With `select()`
|
|
2125
|
+
* ```sql
|
|
2126
|
+
* create table
|
|
2127
|
+
* characters (id int8 primary key, name text);
|
|
2128
|
+
*
|
|
2129
|
+
* insert into
|
|
2130
|
+
* characters (id, name)
|
|
2131
|
+
* values
|
|
2132
|
+
* (1, 'Luke'),
|
|
2133
|
+
* (2, 'Leia'),
|
|
2134
|
+
* (3, 'Han');
|
|
2135
|
+
* ```
|
|
2136
|
+
*
|
|
2137
|
+
* @exampleResponse With `select()`
|
|
2138
|
+
* ```json
|
|
2139
|
+
* {
|
|
2140
|
+
* "data": [
|
|
2141
|
+
* {
|
|
2142
|
+
* "id": 1,
|
|
2143
|
+
* "name": "Luke"
|
|
2144
|
+
* }
|
|
2145
|
+
* ],
|
|
2146
|
+
* "status": 200,
|
|
2147
|
+
* "statusText": "OK"
|
|
2148
|
+
* }
|
|
2149
|
+
* ```
|
|
2150
|
+
*/
|
|
2151
|
+
ilike<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
2152
|
+
ilike(column: string, pattern: string): this;
|
|
2153
|
+
/**
|
|
2154
|
+
* Match only rows where `column` matches all of `patterns` case-insensitively.
|
|
2155
|
+
*
|
|
2156
|
+
* @param column - The column to filter on
|
|
2157
|
+
* @param patterns - The patterns to match with
|
|
2158
|
+
*
|
|
2159
|
+
* @category Database
|
|
2160
|
+
* @subcategory Using filters
|
|
2161
|
+
*/
|
|
2162
|
+
ilikeAllOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
2163
|
+
ilikeAllOf(column: string, patterns: readonly string[]): this;
|
|
2164
|
+
/**
|
|
2165
|
+
* Match only rows where `column` matches any of `patterns` case-insensitively.
|
|
2166
|
+
*
|
|
2167
|
+
* @param column - The column to filter on
|
|
2168
|
+
* @param patterns - The patterns to match with
|
|
2169
|
+
*
|
|
2170
|
+
* @category Database
|
|
2171
|
+
* @subcategory Using filters
|
|
2172
|
+
*/
|
|
2173
|
+
ilikeAnyOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
2174
|
+
ilikeAnyOf(column: string, patterns: readonly string[]): this;
|
|
2175
|
+
/**
|
|
2176
|
+
* Match only rows where `column` matches the PostgreSQL regex `pattern`
|
|
2177
|
+
* case-sensitively (using the `~` operator).
|
|
2178
|
+
*
|
|
2179
|
+
* @param column - The column to filter on
|
|
2180
|
+
* @param pattern - The PostgreSQL regular expression pattern to match with
|
|
2181
|
+
*/
|
|
2182
|
+
regexMatch<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
2183
|
+
regexMatch(column: string, pattern: string): this;
|
|
2184
|
+
/**
|
|
2185
|
+
* Match only rows where `column` matches the PostgreSQL regex `pattern`
|
|
2186
|
+
* case-insensitively (using the `~*` operator).
|
|
2187
|
+
*
|
|
2188
|
+
* @param column - The column to filter on
|
|
2189
|
+
* @param pattern - The PostgreSQL regular expression pattern to match with
|
|
2190
|
+
*/
|
|
2191
|
+
regexIMatch<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
2192
|
+
regexIMatch(column: string, pattern: string): this;
|
|
2193
|
+
/**
|
|
2194
|
+
* Match only rows where `column` IS `value`.
|
|
2195
|
+
*
|
|
2196
|
+
* For non-boolean columns, this is only relevant for checking if the value of
|
|
2197
|
+
* `column` is NULL by setting `value` to `null`.
|
|
2198
|
+
*
|
|
2199
|
+
* For boolean columns, you can also set `value` to `true` or `false` and it
|
|
2200
|
+
* will behave the same way as `.eq()`.
|
|
2201
|
+
*
|
|
2202
|
+
* @param column - The column to filter on
|
|
2203
|
+
* @param value - The value to filter with
|
|
2204
|
+
*
|
|
2205
|
+
* @category Database
|
|
2206
|
+
* @subcategory Using filters
|
|
2207
|
+
*
|
|
2208
|
+
* @exampleDescription Checking for nullness, true or false
|
|
2209
|
+
* Using the `eq()` filter doesn't work when filtering for `null`.
|
|
2210
|
+
*
|
|
2211
|
+
* Instead, you need to use `is()`.
|
|
2212
|
+
*
|
|
2213
|
+
* @example Checking for nullness, true or false
|
|
2214
|
+
* ```ts
|
|
2215
|
+
* const { data, error } = await supabase
|
|
2216
|
+
* .from('countries')
|
|
2217
|
+
* .select()
|
|
2218
|
+
* .is('name', null)
|
|
2219
|
+
* ```
|
|
2220
|
+
*
|
|
2221
|
+
* @exampleSql Checking for nullness, true or false
|
|
2222
|
+
* ```sql
|
|
2223
|
+
* create table
|
|
2224
|
+
* countries (id int8 primary key, name text);
|
|
2225
|
+
*
|
|
2226
|
+
* insert into
|
|
2227
|
+
* countries (id, name)
|
|
2228
|
+
* values
|
|
2229
|
+
* (1, 'null'),
|
|
2230
|
+
* (2, null);
|
|
2231
|
+
* ```
|
|
2232
|
+
*
|
|
2233
|
+
* @exampleResponse Checking for nullness, true or false
|
|
2234
|
+
* ```json
|
|
2235
|
+
* {
|
|
2236
|
+
* "data": [
|
|
2237
|
+
* {
|
|
2238
|
+
* "id": 2,
|
|
2239
|
+
* "name": "null"
|
|
2240
|
+
* }
|
|
2241
|
+
* ],
|
|
2242
|
+
* "status": 200,
|
|
2243
|
+
* "statusText": "OK"
|
|
2244
|
+
* }
|
|
2245
|
+
* ```
|
|
2246
|
+
*/
|
|
2247
|
+
is<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName] & (boolean | null)): this;
|
|
2248
|
+
is(column: string, value: boolean | null): this;
|
|
2249
|
+
/**
|
|
2250
|
+
* Match only rows where `column` IS DISTINCT FROM `value`.
|
|
2251
|
+
*
|
|
2252
|
+
* Unlike `.neq()`, this treats `NULL` as a comparable value. Two `NULL` values
|
|
2253
|
+
* are considered equal (not distinct), and comparing `NULL` with any non-NULL
|
|
2254
|
+
* value returns true (distinct).
|
|
2255
|
+
*
|
|
2256
|
+
* @param column - The column to filter on
|
|
2257
|
+
* @param value - The value to filter with
|
|
2258
|
+
*/
|
|
2259
|
+
isDistinct<ColumnName extends string>(column: ColumnName, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never): this;
|
|
2260
|
+
/**
|
|
2261
|
+
* Match only rows where `column` is included in the `values` array.
|
|
2262
|
+
*
|
|
2263
|
+
* @param column - The column to filter on
|
|
2264
|
+
* @param values - The values array to filter with
|
|
2265
|
+
*
|
|
2266
|
+
* @category Database
|
|
2267
|
+
* @subcategory Using filters
|
|
2268
|
+
*
|
|
2269
|
+
* @example With `select()`
|
|
2270
|
+
* ```ts
|
|
2271
|
+
* const { data, error } = await supabase
|
|
2272
|
+
* .from('characters')
|
|
2273
|
+
* .select()
|
|
2274
|
+
* .in('name', ['Leia', 'Han'])
|
|
2275
|
+
* ```
|
|
2276
|
+
*
|
|
2277
|
+
* @exampleSql With `select()`
|
|
2278
|
+
* ```sql
|
|
2279
|
+
* create table
|
|
2280
|
+
* characters (id int8 primary key, name text);
|
|
2281
|
+
*
|
|
2282
|
+
* insert into
|
|
2283
|
+
* characters (id, name)
|
|
2284
|
+
* values
|
|
2285
|
+
* (1, 'Luke'),
|
|
2286
|
+
* (2, 'Leia'),
|
|
2287
|
+
* (3, 'Han');
|
|
2288
|
+
* ```
|
|
2289
|
+
*
|
|
2290
|
+
* @exampleResponse With `select()`
|
|
2291
|
+
* ```json
|
|
2292
|
+
* {
|
|
2293
|
+
* "data": [
|
|
2294
|
+
* {
|
|
2295
|
+
* "id": 2,
|
|
2296
|
+
* "name": "Leia"
|
|
2297
|
+
* },
|
|
2298
|
+
* {
|
|
2299
|
+
* "id": 3,
|
|
2300
|
+
* "name": "Han"
|
|
2301
|
+
* }
|
|
2302
|
+
* ],
|
|
2303
|
+
* "status": 200,
|
|
2304
|
+
* "statusText": "OK"
|
|
2305
|
+
* }
|
|
2306
|
+
* ```
|
|
2307
|
+
*/
|
|
2308
|
+
in<ColumnName extends string>(column: ColumnName, values: ReadonlyArray<ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never>): this;
|
|
2309
|
+
/**
|
|
2310
|
+
* Match only rows where `column` is NOT included in the `values` array.
|
|
2311
|
+
*
|
|
2312
|
+
* @param column - The column to filter on
|
|
2313
|
+
* @param values - The values array to filter with
|
|
2314
|
+
*/
|
|
2315
|
+
notIn<ColumnName extends string>(column: ColumnName, values: ReadonlyArray<ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never>): this;
|
|
2316
|
+
/**
|
|
2317
|
+
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
2318
|
+
* `column` contains every element appearing in `value`.
|
|
2319
|
+
*
|
|
2320
|
+
* @param column - The jsonb, array, or range column to filter on
|
|
2321
|
+
* @param value - The jsonb, array, or range value to filter with
|
|
2322
|
+
*
|
|
2323
|
+
* @category Database
|
|
2324
|
+
* @subcategory Using filters
|
|
2325
|
+
*
|
|
2326
|
+
* @example On array columns
|
|
2327
|
+
* ```ts
|
|
2328
|
+
* const { data, error } = await supabase
|
|
2329
|
+
* .from('issues')
|
|
2330
|
+
* .select()
|
|
2331
|
+
* .contains('tags', ['is:open', 'priority:low'])
|
|
2332
|
+
* ```
|
|
2333
|
+
*
|
|
2334
|
+
* @exampleSql On array columns
|
|
2335
|
+
* ```sql
|
|
2336
|
+
* create table
|
|
2337
|
+
* issues (
|
|
2338
|
+
* id int8 primary key,
|
|
2339
|
+
* title text,
|
|
2340
|
+
* tags text[]
|
|
2341
|
+
* );
|
|
2342
|
+
*
|
|
2343
|
+
* insert into
|
|
2344
|
+
* issues (id, title, tags)
|
|
2345
|
+
* values
|
|
2346
|
+
* (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),
|
|
2347
|
+
* (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);
|
|
2348
|
+
* ```
|
|
2349
|
+
*
|
|
2350
|
+
* @exampleResponse On array columns
|
|
2351
|
+
* ```json
|
|
2352
|
+
* {
|
|
2353
|
+
* "data": [
|
|
2354
|
+
* {
|
|
2355
|
+
* "title": "Cache invalidation is not working"
|
|
2356
|
+
* }
|
|
2357
|
+
* ],
|
|
2358
|
+
* "status": 200,
|
|
2359
|
+
* "statusText": "OK"
|
|
2360
|
+
* }
|
|
2361
|
+
* ```
|
|
2362
|
+
*
|
|
2363
|
+
* @exampleDescription On range columns
|
|
2364
|
+
* Postgres supports a number of [range
|
|
2365
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2366
|
+
* can filter on range columns using the string representation of range
|
|
2367
|
+
* values.
|
|
2368
|
+
*
|
|
2369
|
+
* @example On range columns
|
|
2370
|
+
* ```ts
|
|
2371
|
+
* const { data, error } = await supabase
|
|
2372
|
+
* .from('reservations')
|
|
2373
|
+
* .select()
|
|
2374
|
+
* .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)')
|
|
2375
|
+
* ```
|
|
2376
|
+
*
|
|
2377
|
+
* @exampleSql On range columns
|
|
2378
|
+
* ```sql
|
|
2379
|
+
* create table
|
|
2380
|
+
* reservations (
|
|
2381
|
+
* id int8 primary key,
|
|
2382
|
+
* room_name text,
|
|
2383
|
+
* during tsrange
|
|
2384
|
+
* );
|
|
2385
|
+
*
|
|
2386
|
+
* insert into
|
|
2387
|
+
* reservations (id, room_name, during)
|
|
2388
|
+
* values
|
|
2389
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2390
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2391
|
+
* ```
|
|
2392
|
+
*
|
|
2393
|
+
* @exampleResponse On range columns
|
|
2394
|
+
* ```json
|
|
2395
|
+
* {
|
|
2396
|
+
* "data": [
|
|
2397
|
+
* {
|
|
2398
|
+
* "id": 1,
|
|
2399
|
+
* "room_name": "Emerald",
|
|
2400
|
+
* "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
|
|
2401
|
+
* }
|
|
2402
|
+
* ],
|
|
2403
|
+
* "status": 200,
|
|
2404
|
+
* "statusText": "OK"
|
|
2405
|
+
* }
|
|
2406
|
+
* ```
|
|
2407
|
+
*
|
|
2408
|
+
* @example On `jsonb` columns
|
|
2409
|
+
* ```ts
|
|
2410
|
+
* const { data, error } = await supabase
|
|
2411
|
+
* .from('users')
|
|
2412
|
+
* .select('name')
|
|
2413
|
+
* .contains('address', { postcode: 90210 })
|
|
2414
|
+
* ```
|
|
2415
|
+
*
|
|
2416
|
+
* @exampleSql On `jsonb` columns
|
|
2417
|
+
* ```sql
|
|
2418
|
+
* create table
|
|
2419
|
+
* users (
|
|
2420
|
+
* id int8 primary key,
|
|
2421
|
+
* name text,
|
|
2422
|
+
* address jsonb
|
|
2423
|
+
* );
|
|
2424
|
+
*
|
|
2425
|
+
* insert into
|
|
2426
|
+
* users (id, name, address)
|
|
2427
|
+
* values
|
|
2428
|
+
* (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),
|
|
2429
|
+
* (2, 'Jane', '{}');
|
|
2430
|
+
* ```
|
|
2431
|
+
*
|
|
2432
|
+
* @exampleResponse On `jsonb` columns
|
|
2433
|
+
* ```json
|
|
2434
|
+
* {
|
|
2435
|
+
* "data": [
|
|
2436
|
+
* {
|
|
2437
|
+
* "name": "Michael"
|
|
2438
|
+
* }
|
|
2439
|
+
* ],
|
|
2440
|
+
* "status": 200,
|
|
2441
|
+
* "statusText": "OK"
|
|
2442
|
+
* }
|
|
2443
|
+
* ```
|
|
2444
|
+
*/
|
|
2445
|
+
contains<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]> | Record<string, unknown>): this;
|
|
2446
|
+
contains(column: string, value: string | readonly unknown[] | Record<string, unknown>): this;
|
|
2447
|
+
/**
|
|
2448
|
+
* Only relevant for jsonb, array, and range columns. Match only rows where
|
|
2449
|
+
* every element appearing in `column` is contained by `value`.
|
|
2450
|
+
*
|
|
2451
|
+
* @param column - The jsonb, array, or range column to filter on
|
|
2452
|
+
* @param value - The jsonb, array, or range value to filter with
|
|
2453
|
+
*
|
|
2454
|
+
* @category Database
|
|
2455
|
+
* @subcategory Using filters
|
|
2456
|
+
*
|
|
2457
|
+
* @example On array columns
|
|
2458
|
+
* ```ts
|
|
2459
|
+
* const { data, error } = await supabase
|
|
2460
|
+
* .from('classes')
|
|
2461
|
+
* .select('name')
|
|
2462
|
+
* .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])
|
|
2463
|
+
* ```
|
|
2464
|
+
*
|
|
2465
|
+
* @exampleSql On array columns
|
|
2466
|
+
* ```sql
|
|
2467
|
+
* create table
|
|
2468
|
+
* classes (
|
|
2469
|
+
* id int8 primary key,
|
|
2470
|
+
* name text,
|
|
2471
|
+
* days text[]
|
|
2472
|
+
* );
|
|
2473
|
+
*
|
|
2474
|
+
* insert into
|
|
2475
|
+
* classes (id, name, days)
|
|
2476
|
+
* values
|
|
2477
|
+
* (1, 'Chemistry', array['monday', 'friday']),
|
|
2478
|
+
* (2, 'History', array['monday', 'wednesday', 'thursday']);
|
|
2479
|
+
* ```
|
|
2480
|
+
*
|
|
2481
|
+
* @exampleResponse On array columns
|
|
2482
|
+
* ```json
|
|
2483
|
+
* {
|
|
2484
|
+
* "data": [
|
|
2485
|
+
* {
|
|
2486
|
+
* "name": "Chemistry"
|
|
2487
|
+
* }
|
|
2488
|
+
* ],
|
|
2489
|
+
* "status": 200,
|
|
2490
|
+
* "statusText": "OK"
|
|
2491
|
+
* }
|
|
2492
|
+
* ```
|
|
2493
|
+
*
|
|
2494
|
+
* @exampleDescription On range columns
|
|
2495
|
+
* Postgres supports a number of [range
|
|
2496
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2497
|
+
* can filter on range columns using the string representation of range
|
|
2498
|
+
* values.
|
|
2499
|
+
*
|
|
2500
|
+
* @example On range columns
|
|
2501
|
+
* ```ts
|
|
2502
|
+
* const { data, error } = await supabase
|
|
2503
|
+
* .from('reservations')
|
|
2504
|
+
* .select()
|
|
2505
|
+
* .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')
|
|
2506
|
+
* ```
|
|
2507
|
+
*
|
|
2508
|
+
* @exampleSql On range columns
|
|
2509
|
+
* ```sql
|
|
2510
|
+
* create table
|
|
2511
|
+
* reservations (
|
|
2512
|
+
* id int8 primary key,
|
|
2513
|
+
* room_name text,
|
|
2514
|
+
* during tsrange
|
|
2515
|
+
* );
|
|
2516
|
+
*
|
|
2517
|
+
* insert into
|
|
2518
|
+
* reservations (id, room_name, during)
|
|
2519
|
+
* values
|
|
2520
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2521
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2522
|
+
* ```
|
|
2523
|
+
*
|
|
2524
|
+
* @exampleResponse On range columns
|
|
2525
|
+
* ```json
|
|
2526
|
+
* {
|
|
2527
|
+
* "data": [
|
|
2528
|
+
* {
|
|
2529
|
+
* "id": 1,
|
|
2530
|
+
* "room_name": "Emerald",
|
|
2531
|
+
* "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
|
|
2532
|
+
* }
|
|
2533
|
+
* ],
|
|
2534
|
+
* "status": 200,
|
|
2535
|
+
* "statusText": "OK"
|
|
2536
|
+
* }
|
|
2537
|
+
* ```
|
|
2538
|
+
*
|
|
2539
|
+
* @example On `jsonb` columns
|
|
2540
|
+
* ```ts
|
|
2541
|
+
* const { data, error } = await supabase
|
|
2542
|
+
* .from('users')
|
|
2543
|
+
* .select('name')
|
|
2544
|
+
* .containedBy('address', {})
|
|
2545
|
+
* ```
|
|
2546
|
+
*
|
|
2547
|
+
* @exampleSql On `jsonb` columns
|
|
2548
|
+
* ```sql
|
|
2549
|
+
* create table
|
|
2550
|
+
* users (
|
|
2551
|
+
* id int8 primary key,
|
|
2552
|
+
* name text,
|
|
2553
|
+
* address jsonb
|
|
2554
|
+
* );
|
|
2555
|
+
*
|
|
2556
|
+
* insert into
|
|
2557
|
+
* users (id, name, address)
|
|
2558
|
+
* values
|
|
2559
|
+
* (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),
|
|
2560
|
+
* (2, 'Jane', '{}');
|
|
2561
|
+
* ```
|
|
2562
|
+
*
|
|
2563
|
+
* @exampleResponse On `jsonb` columns
|
|
2564
|
+
* ```json
|
|
2565
|
+
* {
|
|
2566
|
+
* "data": [
|
|
2567
|
+
* {
|
|
2568
|
+
* "name": "Jane"
|
|
2569
|
+
* }
|
|
2570
|
+
* ],
|
|
2571
|
+
* "status": 200,
|
|
2572
|
+
* "statusText": "OK"
|
|
2573
|
+
* }
|
|
2574
|
+
*
|
|
2575
|
+
* ```
|
|
2576
|
+
*/
|
|
2577
|
+
containedBy<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]> | Record<string, unknown>): this;
|
|
2578
|
+
containedBy(column: string, value: string | readonly unknown[] | Record<string, unknown>): this;
|
|
2579
|
+
/**
|
|
2580
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
2581
|
+
* `column` is greater than any element in `range`.
|
|
2582
|
+
*
|
|
2583
|
+
* @param column - The range column to filter on
|
|
2584
|
+
* @param range - The range to filter with
|
|
2585
|
+
*
|
|
2586
|
+
* @category Database
|
|
2587
|
+
* @subcategory Using filters
|
|
2588
|
+
*
|
|
2589
|
+
* @exampleDescription With `select()`
|
|
2590
|
+
* Postgres supports a number of [range
|
|
2591
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2592
|
+
* can filter on range columns using the string representation of range
|
|
2593
|
+
* values.
|
|
2594
|
+
*
|
|
2595
|
+
* @example With `select()`
|
|
2596
|
+
* ```ts
|
|
2597
|
+
* const { data, error } = await supabase
|
|
2598
|
+
* .from('reservations')
|
|
2599
|
+
* .select()
|
|
2600
|
+
* .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')
|
|
2601
|
+
* ```
|
|
2602
|
+
*
|
|
2603
|
+
* @exampleSql With `select()`
|
|
2604
|
+
* ```sql
|
|
2605
|
+
* create table
|
|
2606
|
+
* reservations (
|
|
2607
|
+
* id int8 primary key,
|
|
2608
|
+
* room_name text,
|
|
2609
|
+
* during tsrange
|
|
2610
|
+
* );
|
|
2611
|
+
*
|
|
2612
|
+
* insert into
|
|
2613
|
+
* reservations (id, room_name, during)
|
|
2614
|
+
* values
|
|
2615
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2616
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2617
|
+
* ```
|
|
2618
|
+
*
|
|
2619
|
+
* @exampleResponse With `select()`
|
|
2620
|
+
* ```json
|
|
2621
|
+
* {
|
|
2622
|
+
* "data": [
|
|
2623
|
+
* {
|
|
2624
|
+
* "id": 2,
|
|
2625
|
+
* "room_name": "Topaz",
|
|
2626
|
+
* "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"
|
|
2627
|
+
* }
|
|
2628
|
+
* ],
|
|
2629
|
+
* "status": 200,
|
|
2630
|
+
* "statusText": "OK"
|
|
2631
|
+
* }
|
|
2632
|
+
*
|
|
2633
|
+
* ```
|
|
2634
|
+
*/
|
|
2635
|
+
rangeGt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
2636
|
+
rangeGt(column: string, range: string): this;
|
|
2637
|
+
/**
|
|
2638
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
2639
|
+
* `column` is either contained in `range` or greater than any element in
|
|
2640
|
+
* `range`.
|
|
2641
|
+
*
|
|
2642
|
+
* @param column - The range column to filter on
|
|
2643
|
+
* @param range - The range to filter with
|
|
2644
|
+
*
|
|
2645
|
+
* @category Database
|
|
2646
|
+
* @subcategory Using filters
|
|
2647
|
+
*
|
|
2648
|
+
* @exampleDescription With `select()`
|
|
2649
|
+
* Postgres supports a number of [range
|
|
2650
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2651
|
+
* can filter on range columns using the string representation of range
|
|
2652
|
+
* values.
|
|
2653
|
+
*
|
|
2654
|
+
* @example With `select()`
|
|
2655
|
+
* ```ts
|
|
2656
|
+
* const { data, error } = await supabase
|
|
2657
|
+
* .from('reservations')
|
|
2658
|
+
* .select()
|
|
2659
|
+
* .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')
|
|
2660
|
+
* ```
|
|
2661
|
+
*
|
|
2662
|
+
* @exampleSql With `select()`
|
|
2663
|
+
* ```sql
|
|
2664
|
+
* create table
|
|
2665
|
+
* reservations (
|
|
2666
|
+
* id int8 primary key,
|
|
2667
|
+
* room_name text,
|
|
2668
|
+
* during tsrange
|
|
2669
|
+
* );
|
|
2670
|
+
*
|
|
2671
|
+
* insert into
|
|
2672
|
+
* reservations (id, room_name, during)
|
|
2673
|
+
* values
|
|
2674
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2675
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2676
|
+
* ```
|
|
2677
|
+
*
|
|
2678
|
+
* @exampleResponse With `select()`
|
|
2679
|
+
* ```json
|
|
2680
|
+
* {
|
|
2681
|
+
* "data": [
|
|
2682
|
+
* {
|
|
2683
|
+
* "id": 2,
|
|
2684
|
+
* "room_name": "Topaz",
|
|
2685
|
+
* "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"
|
|
2686
|
+
* }
|
|
2687
|
+
* ],
|
|
2688
|
+
* "status": 200,
|
|
2689
|
+
* "statusText": "OK"
|
|
2690
|
+
* }
|
|
2691
|
+
*
|
|
2692
|
+
* ```
|
|
2693
|
+
*/
|
|
2694
|
+
rangeGte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
2695
|
+
rangeGte(column: string, range: string): this;
|
|
2696
|
+
/**
|
|
2697
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
2698
|
+
* `column` is less than any element in `range`.
|
|
2699
|
+
*
|
|
2700
|
+
* @param column - The range column to filter on
|
|
2701
|
+
* @param range - The range to filter with
|
|
2702
|
+
*
|
|
2703
|
+
* @category Database
|
|
2704
|
+
* @subcategory Using filters
|
|
2705
|
+
*
|
|
2706
|
+
* @exampleDescription With `select()`
|
|
2707
|
+
* Postgres supports a number of [range
|
|
2708
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2709
|
+
* can filter on range columns using the string representation of range
|
|
2710
|
+
* values.
|
|
2711
|
+
*
|
|
2712
|
+
* @example With `select()`
|
|
2713
|
+
* ```ts
|
|
2714
|
+
* const { data, error } = await supabase
|
|
2715
|
+
* .from('reservations')
|
|
2716
|
+
* .select()
|
|
2717
|
+
* .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')
|
|
2718
|
+
* ```
|
|
2719
|
+
*
|
|
2720
|
+
* @exampleSql With `select()`
|
|
2721
|
+
* ```sql
|
|
2722
|
+
* create table
|
|
2723
|
+
* reservations (
|
|
2724
|
+
* id int8 primary key,
|
|
2725
|
+
* room_name text,
|
|
2726
|
+
* during tsrange
|
|
2727
|
+
* );
|
|
2728
|
+
*
|
|
2729
|
+
* insert into
|
|
2730
|
+
* reservations (id, room_name, during)
|
|
2731
|
+
* values
|
|
2732
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2733
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2734
|
+
* ```
|
|
2735
|
+
*
|
|
2736
|
+
* @exampleResponse With `select()`
|
|
2737
|
+
* ```json
|
|
2738
|
+
* {
|
|
2739
|
+
* "data": [
|
|
2740
|
+
* {
|
|
2741
|
+
* "id": 1,
|
|
2742
|
+
* "room_name": "Emerald",
|
|
2743
|
+
* "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
|
|
2744
|
+
* }
|
|
2745
|
+
* ],
|
|
2746
|
+
* "status": 200,
|
|
2747
|
+
* "statusText": "OK"
|
|
2748
|
+
* }
|
|
2749
|
+
* ```
|
|
2750
|
+
*/
|
|
2751
|
+
rangeLt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
2752
|
+
rangeLt(column: string, range: string): this;
|
|
2753
|
+
/**
|
|
2754
|
+
* Only relevant for range columns. Match only rows where every element in
|
|
2755
|
+
* `column` is either contained in `range` or less than any element in
|
|
2756
|
+
* `range`.
|
|
2757
|
+
*
|
|
2758
|
+
* @param column - The range column to filter on
|
|
2759
|
+
* @param range - The range to filter with
|
|
2760
|
+
*
|
|
2761
|
+
* @category Database
|
|
2762
|
+
* @subcategory Using filters
|
|
2763
|
+
*
|
|
2764
|
+
* @exampleDescription With `select()`
|
|
2765
|
+
* Postgres supports a number of [range
|
|
2766
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2767
|
+
* can filter on range columns using the string representation of range
|
|
2768
|
+
* values.
|
|
2769
|
+
*
|
|
2770
|
+
* @example With `select()`
|
|
2771
|
+
* ```ts
|
|
2772
|
+
* const { data, error } = await supabase
|
|
2773
|
+
* .from('reservations')
|
|
2774
|
+
* .select()
|
|
2775
|
+
* .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')
|
|
2776
|
+
* ```
|
|
2777
|
+
*
|
|
2778
|
+
* @exampleSql With `select()`
|
|
2779
|
+
* ```sql
|
|
2780
|
+
* create table
|
|
2781
|
+
* reservations (
|
|
2782
|
+
* id int8 primary key,
|
|
2783
|
+
* room_name text,
|
|
2784
|
+
* during tsrange
|
|
2785
|
+
* );
|
|
2786
|
+
*
|
|
2787
|
+
* insert into
|
|
2788
|
+
* reservations (id, room_name, during)
|
|
2789
|
+
* values
|
|
2790
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2791
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2792
|
+
* ```
|
|
2793
|
+
*
|
|
2794
|
+
* @exampleResponse With `select()`
|
|
2795
|
+
* ```json
|
|
2796
|
+
* {
|
|
2797
|
+
* "data": [
|
|
2798
|
+
* {
|
|
2799
|
+
* "id": 1,
|
|
2800
|
+
* "room_name": "Emerald",
|
|
2801
|
+
* "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
|
|
2802
|
+
* }
|
|
2803
|
+
* ],
|
|
2804
|
+
* "status": 200,
|
|
2805
|
+
* "statusText": "OK"
|
|
2806
|
+
* }
|
|
2807
|
+
*
|
|
2808
|
+
* ```
|
|
2809
|
+
*/
|
|
2810
|
+
rangeLte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
2811
|
+
rangeLte(column: string, range: string): this;
|
|
2812
|
+
/**
|
|
2813
|
+
* Only relevant for range columns. Match only rows where `column` is
|
|
2814
|
+
* mutually exclusive to `range` and there can be no element between the two
|
|
2815
|
+
* ranges.
|
|
2816
|
+
*
|
|
2817
|
+
* @param column - The range column to filter on
|
|
2818
|
+
* @param range - The range to filter with
|
|
2819
|
+
*
|
|
2820
|
+
* @category Database
|
|
2821
|
+
* @subcategory Using filters
|
|
2822
|
+
*
|
|
2823
|
+
* @exampleDescription With `select()`
|
|
2824
|
+
* Postgres supports a number of [range
|
|
2825
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2826
|
+
* can filter on range columns using the string representation of range
|
|
2827
|
+
* values.
|
|
2828
|
+
*
|
|
2829
|
+
* @example With `select()`
|
|
2830
|
+
* ```ts
|
|
2831
|
+
* const { data, error } = await supabase
|
|
2832
|
+
* .from('reservations')
|
|
2833
|
+
* .select()
|
|
2834
|
+
* .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')
|
|
2835
|
+
* ```
|
|
2836
|
+
*
|
|
2837
|
+
* @exampleSql With `select()`
|
|
2838
|
+
* ```sql
|
|
2839
|
+
* create table
|
|
2840
|
+
* reservations (
|
|
2841
|
+
* id int8 primary key,
|
|
2842
|
+
* room_name text,
|
|
2843
|
+
* during tsrange
|
|
2844
|
+
* );
|
|
2845
|
+
*
|
|
2846
|
+
* insert into
|
|
2847
|
+
* reservations (id, room_name, during)
|
|
2848
|
+
* values
|
|
2849
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2850
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
2851
|
+
* ```
|
|
2852
|
+
*
|
|
2853
|
+
* @exampleResponse With `select()`
|
|
2854
|
+
* ```json
|
|
2855
|
+
* {
|
|
2856
|
+
* "data": [
|
|
2857
|
+
* {
|
|
2858
|
+
* "id": 1,
|
|
2859
|
+
* "room_name": "Emerald",
|
|
2860
|
+
* "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
|
|
2861
|
+
* }
|
|
2862
|
+
* ],
|
|
2863
|
+
* "status": 200,
|
|
2864
|
+
* "statusText": "OK"
|
|
2865
|
+
* }
|
|
2866
|
+
* ```
|
|
2867
|
+
*/
|
|
2868
|
+
rangeAdjacent<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
2869
|
+
rangeAdjacent(column: string, range: string): this;
|
|
2870
|
+
/**
|
|
2871
|
+
* Only relevant for array and range columns. Match only rows where
|
|
2872
|
+
* `column` and `value` have an element in common.
|
|
2873
|
+
*
|
|
2874
|
+
* @param column - The array or range column to filter on
|
|
2875
|
+
* @param value - The array or range value to filter with
|
|
2876
|
+
*
|
|
2877
|
+
* @category Database
|
|
2878
|
+
* @subcategory Using filters
|
|
2879
|
+
*
|
|
2880
|
+
* @example On array columns
|
|
2881
|
+
* ```ts
|
|
2882
|
+
* const { data, error } = await supabase
|
|
2883
|
+
* .from('issues')
|
|
2884
|
+
* .select('title')
|
|
2885
|
+
* .overlaps('tags', ['is:closed', 'severity:high'])
|
|
2886
|
+
* ```
|
|
2887
|
+
*
|
|
2888
|
+
* @exampleSql On array columns
|
|
2889
|
+
* ```sql
|
|
2890
|
+
* create table
|
|
2891
|
+
* issues (
|
|
2892
|
+
* id int8 primary key,
|
|
2893
|
+
* title text,
|
|
2894
|
+
* tags text[]
|
|
2895
|
+
* );
|
|
2896
|
+
*
|
|
2897
|
+
* insert into
|
|
2898
|
+
* issues (id, title, tags)
|
|
2899
|
+
* values
|
|
2900
|
+
* (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),
|
|
2901
|
+
* (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);
|
|
2902
|
+
* ```
|
|
2903
|
+
*
|
|
2904
|
+
* @exampleResponse On array columns
|
|
2905
|
+
* ```json
|
|
2906
|
+
* {
|
|
2907
|
+
* "data": [
|
|
2908
|
+
* {
|
|
2909
|
+
* "title": "Cache invalidation is not working"
|
|
2910
|
+
* }
|
|
2911
|
+
* ],
|
|
2912
|
+
* "status": 200,
|
|
2913
|
+
* "statusText": "OK"
|
|
2914
|
+
* }
|
|
2915
|
+
* ```
|
|
2916
|
+
*
|
|
2917
|
+
* @exampleDescription On range columns
|
|
2918
|
+
* Postgres supports a number of [range
|
|
2919
|
+
* types](https://www.postgresql.org/docs/current/rangetypes.html). You
|
|
2920
|
+
* can filter on range columns using the string representation of range
|
|
2921
|
+
* values.
|
|
2922
|
+
*
|
|
2923
|
+
* @example On range columns
|
|
2924
|
+
* ```ts
|
|
2925
|
+
* const { data, error } = await supabase
|
|
2926
|
+
* .from('reservations')
|
|
2927
|
+
* .select()
|
|
2928
|
+
* .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)')
|
|
2929
|
+
* ```
|
|
2930
|
+
*
|
|
2931
|
+
* @exampleSql On range columns
|
|
2932
|
+
* ```sql
|
|
2933
|
+
* create table
|
|
2934
|
+
* reservations (
|
|
2935
|
+
* id int8 primary key,
|
|
2936
|
+
* room_name text,
|
|
2937
|
+
* during tsrange
|
|
2938
|
+
* );
|
|
1748
2939
|
*
|
|
1749
2940
|
* insert into
|
|
1750
|
-
*
|
|
2941
|
+
* reservations (id, room_name, during)
|
|
1751
2942
|
* values
|
|
1752
|
-
* (1, '
|
|
1753
|
-
* (2, '
|
|
1754
|
-
* (3, 'Han');
|
|
2943
|
+
* (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),
|
|
2944
|
+
* (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');
|
|
1755
2945
|
* ```
|
|
1756
2946
|
*
|
|
1757
|
-
* @exampleResponse
|
|
2947
|
+
* @exampleResponse On range columns
|
|
1758
2948
|
* ```json
|
|
1759
2949
|
* {
|
|
1760
2950
|
* "data": [
|
|
1761
2951
|
* {
|
|
1762
|
-
* "id":
|
|
1763
|
-
* "
|
|
2952
|
+
* "id": 1,
|
|
2953
|
+
* "room_name": "Emerald",
|
|
2954
|
+
* "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"
|
|
1764
2955
|
* }
|
|
1765
2956
|
* ],
|
|
1766
2957
|
* "status": 200,
|
|
@@ -1768,101 +2959,126 @@ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions,
|
|
|
1768
2959
|
* }
|
|
1769
2960
|
* ```
|
|
1770
2961
|
*/
|
|
1771
|
-
|
|
2962
|
+
overlaps<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]>): this;
|
|
2963
|
+
overlaps(column: string, value: string | readonly unknown[]): this;
|
|
1772
2964
|
/**
|
|
1773
|
-
*
|
|
1774
|
-
*
|
|
1775
|
-
* This filter does not include rows where `column` is `NULL`. To match null
|
|
1776
|
-
* values, use `.is(column, null)` instead.
|
|
2965
|
+
* Only relevant for text and tsvector columns. Match only rows where
|
|
2966
|
+
* `column` matches the query string in `query`.
|
|
1777
2967
|
*
|
|
1778
|
-
* @param column - The column to filter on
|
|
1779
|
-
* @param
|
|
2968
|
+
* @param column - The text or tsvector column to filter on
|
|
2969
|
+
* @param query - The query text to match with
|
|
2970
|
+
* @param options - Named parameters
|
|
2971
|
+
* @param options.config - The text search configuration to use
|
|
2972
|
+
* @param options.type - Change how the `query` text is interpreted
|
|
1780
2973
|
*
|
|
1781
2974
|
* @category Database
|
|
1782
2975
|
* @subcategory Using filters
|
|
1783
2976
|
*
|
|
1784
|
-
* @
|
|
2977
|
+
* @remarks
|
|
2978
|
+
* - For more information, see [Postgres full text search](/docs/guides/database/full-text-search).
|
|
2979
|
+
*
|
|
2980
|
+
* @example Text search
|
|
1785
2981
|
* ```ts
|
|
1786
|
-
* const
|
|
1787
|
-
* .from(
|
|
1788
|
-
* .select()
|
|
1789
|
-
* .
|
|
2982
|
+
* const result = await supabase
|
|
2983
|
+
* .from("texts")
|
|
2984
|
+
* .select("content")
|
|
2985
|
+
* .textSearch("content", `'eggs' & 'ham'`, {
|
|
2986
|
+
* config: "english",
|
|
2987
|
+
* });
|
|
1790
2988
|
* ```
|
|
1791
2989
|
*
|
|
1792
|
-
* @exampleSql
|
|
2990
|
+
* @exampleSql Text search
|
|
1793
2991
|
* ```sql
|
|
1794
|
-
* create table
|
|
1795
|
-
*
|
|
2992
|
+
* create table texts (
|
|
2993
|
+
* id bigint
|
|
2994
|
+
* primary key
|
|
2995
|
+
* generated always as identity,
|
|
2996
|
+
* content text
|
|
2997
|
+
* );
|
|
1796
2998
|
*
|
|
1797
|
-
* insert into
|
|
1798
|
-
*
|
|
1799
|
-
*
|
|
1800
|
-
*
|
|
1801
|
-
*
|
|
1802
|
-
* (3, 'Han');
|
|
2999
|
+
* insert into texts (content) values
|
|
3000
|
+
* ('Four score and seven years ago'),
|
|
3001
|
+
* ('The road goes ever on and on'),
|
|
3002
|
+
* ('Green eggs and ham')
|
|
3003
|
+
* ;
|
|
1803
3004
|
* ```
|
|
1804
3005
|
*
|
|
1805
|
-
* @exampleResponse
|
|
3006
|
+
* @exampleResponse Text search
|
|
1806
3007
|
* ```json
|
|
1807
3008
|
* {
|
|
1808
3009
|
* "data": [
|
|
1809
3010
|
* {
|
|
1810
|
-
* "
|
|
1811
|
-
* "name": "Luke"
|
|
1812
|
-
* },
|
|
1813
|
-
* {
|
|
1814
|
-
* "id": 3,
|
|
1815
|
-
* "name": "Han"
|
|
3011
|
+
* "content": "Green eggs and ham"
|
|
1816
3012
|
* }
|
|
1817
3013
|
* ],
|
|
1818
3014
|
* "status": 200,
|
|
1819
3015
|
* "statusText": "OK"
|
|
1820
3016
|
* }
|
|
1821
3017
|
* ```
|
|
1822
|
-
*/
|
|
1823
|
-
neq<ColumnName extends string>(column: ColumnName extends keyof Row ? ColumnName : ColumnName extends `${string}.${string}` | `${string}->${string}` ? ColumnName : string extends ColumnName ? string : keyof Row, value: ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer Resolved ? Resolved : never): this;
|
|
1824
|
-
gt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1825
|
-
gt(column: string, value: unknown): this;
|
|
1826
|
-
gte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1827
|
-
gte(column: string, value: unknown): this;
|
|
1828
|
-
lt<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1829
|
-
lt(column: string, value: unknown): this;
|
|
1830
|
-
lte<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName]): this;
|
|
1831
|
-
lte(column: string, value: unknown): this;
|
|
1832
|
-
like<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
1833
|
-
like(column: string, pattern: string): this;
|
|
1834
|
-
likeAllOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
1835
|
-
likeAllOf(column: string, patterns: readonly string[]): this;
|
|
1836
|
-
likeAnyOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
1837
|
-
likeAnyOf(column: string, patterns: readonly string[]): this;
|
|
1838
|
-
ilike<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
1839
|
-
ilike(column: string, pattern: string): this;
|
|
1840
|
-
ilikeAllOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
1841
|
-
ilikeAllOf(column: string, patterns: readonly string[]): this;
|
|
1842
|
-
ilikeAnyOf<ColumnName extends string & keyof Row>(column: ColumnName, patterns: readonly string[]): this;
|
|
1843
|
-
ilikeAnyOf(column: string, patterns: readonly string[]): this;
|
|
1844
|
-
regexMatch<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
1845
|
-
regexMatch(column: string, pattern: string): this;
|
|
1846
|
-
regexIMatch<ColumnName extends string & keyof Row>(column: ColumnName, pattern: string): this;
|
|
1847
|
-
regexIMatch(column: string, pattern: string): this;
|
|
1848
|
-
is<ColumnName extends string & keyof Row>(column: ColumnName, value: Row[ColumnName] & (boolean | null)): this;
|
|
1849
|
-
is(column: string, value: boolean | null): this;
|
|
1850
|
-
/**
|
|
1851
|
-
* Match only rows where `column` IS DISTINCT FROM `value`.
|
|
1852
3018
|
*
|
|
1853
|
-
*
|
|
1854
|
-
*
|
|
1855
|
-
* value returns true (distinct).
|
|
3019
|
+
* @exampleDescription Basic normalization
|
|
3020
|
+
* Uses PostgreSQL's `plainto_tsquery` function.
|
|
1856
3021
|
*
|
|
1857
|
-
* @
|
|
1858
|
-
*
|
|
3022
|
+
* @example Basic normalization
|
|
3023
|
+
* ```ts
|
|
3024
|
+
* const { data, error } = await supabase
|
|
3025
|
+
* .from('quotes')
|
|
3026
|
+
* .select('catchphrase')
|
|
3027
|
+
* .textSearch('catchphrase', `'fat' & 'cat'`, {
|
|
3028
|
+
* type: 'plain',
|
|
3029
|
+
* config: 'english'
|
|
3030
|
+
* })
|
|
3031
|
+
* ```
|
|
3032
|
+
*
|
|
3033
|
+
* @exampleDescription Full normalization
|
|
3034
|
+
* Uses PostgreSQL's `phraseto_tsquery` function.
|
|
3035
|
+
*
|
|
3036
|
+
* @example Full normalization
|
|
3037
|
+
* ```ts
|
|
3038
|
+
* const { data, error } = await supabase
|
|
3039
|
+
* .from('quotes')
|
|
3040
|
+
* .select('catchphrase')
|
|
3041
|
+
* .textSearch('catchphrase', `'fat' & 'cat'`, {
|
|
3042
|
+
* type: 'phrase',
|
|
3043
|
+
* config: 'english'
|
|
3044
|
+
* })
|
|
3045
|
+
* ```
|
|
3046
|
+
*
|
|
3047
|
+
* @exampleDescription Websearch
|
|
3048
|
+
* Uses PostgreSQL's `websearch_to_tsquery` function.
|
|
3049
|
+
* This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used
|
|
3050
|
+
* with advanced operators.
|
|
3051
|
+
*
|
|
3052
|
+
* - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.
|
|
3053
|
+
* - `"quoted text"`: text inside quote marks will be converted to terms separated by `<->` operators, as if processed by phraseto_tsquery.
|
|
3054
|
+
* - `OR`: the word “or” will be converted to the | operator.
|
|
3055
|
+
* - `-`: a dash will be converted to the ! operator.
|
|
3056
|
+
*
|
|
3057
|
+
* @example Websearch
|
|
3058
|
+
* ```ts
|
|
3059
|
+
* const { data, error } = await supabase
|
|
3060
|
+
* .from('quotes')
|
|
3061
|
+
* .select('catchphrase')
|
|
3062
|
+
* .textSearch('catchphrase', `'fat or cat'`, {
|
|
3063
|
+
* type: 'websearch',
|
|
3064
|
+
* config: 'english'
|
|
3065
|
+
* })
|
|
3066
|
+
* ```
|
|
1859
3067
|
*/
|
|
1860
|
-
|
|
3068
|
+
textSearch<ColumnName extends string & keyof Row>(column: ColumnName, query: string, options?: {
|
|
3069
|
+
config?: string;
|
|
3070
|
+
type?: 'plain' | 'phrase' | 'websearch';
|
|
3071
|
+
}): this;
|
|
3072
|
+
textSearch(column: string, query: string, options?: {
|
|
3073
|
+
config?: string;
|
|
3074
|
+
type?: 'plain' | 'phrase' | 'websearch';
|
|
3075
|
+
}): this;
|
|
1861
3076
|
/**
|
|
1862
|
-
* Match only rows where
|
|
3077
|
+
* Match only rows where each column in `query` keys is equal to its
|
|
3078
|
+
* associated value. Shorthand for multiple `.eq()`s.
|
|
1863
3079
|
*
|
|
1864
|
-
* @param
|
|
1865
|
-
*
|
|
3080
|
+
* @param query - The object to filter with, with column names as keys mapped
|
|
3081
|
+
* to their filter values
|
|
1866
3082
|
*
|
|
1867
3083
|
* @category Database
|
|
1868
3084
|
* @subcategory Using filters
|
|
@@ -1871,8 +3087,8 @@ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions,
|
|
|
1871
3087
|
* ```ts
|
|
1872
3088
|
* const { data, error } = await supabase
|
|
1873
3089
|
* .from('characters')
|
|
1874
|
-
* .select()
|
|
1875
|
-
* .
|
|
3090
|
+
* .select('name')
|
|
3091
|
+
* .match({ id: 2, name: 'Leia' })
|
|
1876
3092
|
* ```
|
|
1877
3093
|
*
|
|
1878
3094
|
* @exampleSql With `select()`
|
|
@@ -1893,12 +3109,7 @@ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions,
|
|
|
1893
3109
|
* {
|
|
1894
3110
|
* "data": [
|
|
1895
3111
|
* {
|
|
1896
|
-
* "id": 2,
|
|
1897
3112
|
* "name": "Leia"
|
|
1898
|
-
* },
|
|
1899
|
-
* {
|
|
1900
|
-
* "id": 3,
|
|
1901
|
-
* "name": "Han"
|
|
1902
3113
|
* }
|
|
1903
3114
|
* ],
|
|
1904
3115
|
* "status": 200,
|
|
@@ -1906,40 +3117,24 @@ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions,
|
|
|
1906
3117
|
* }
|
|
1907
3118
|
* ```
|
|
1908
3119
|
*/
|
|
1909
|
-
|
|
3120
|
+
match<ColumnName extends string & keyof Row>(query: Record<ColumnName, Row[ColumnName]>): this;
|
|
3121
|
+
match(query: Record<string, unknown>): this;
|
|
1910
3122
|
/**
|
|
1911
|
-
* Match only rows
|
|
3123
|
+
* Match only rows which doesn't satisfy the filter.
|
|
3124
|
+
*
|
|
3125
|
+
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
3126
|
+
* follow [PostgREST
|
|
3127
|
+
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
3128
|
+
* to make sure they are properly sanitized.
|
|
1912
3129
|
*
|
|
1913
3130
|
* @param column - The column to filter on
|
|
1914
|
-
* @param
|
|
3131
|
+
* @param operator - The operator to be negated to filter with, following
|
|
3132
|
+
* PostgREST syntax
|
|
3133
|
+
* @param value - The value to filter with, following PostgREST syntax
|
|
3134
|
+
*
|
|
3135
|
+
* @category Database
|
|
3136
|
+
* @subcategory Using filters
|
|
1915
3137
|
*/
|
|
1916
|
-
notIn<ColumnName extends string>(column: ColumnName, values: ReadonlyArray<ResolveFilterValue<Schema, Row, ColumnName> extends never ? unknown : ResolveFilterValue<Schema, Row, ColumnName> extends infer ResolvedFilterValue ? ResolvedFilterValue : never>): this;
|
|
1917
|
-
contains<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]> | Record<string, unknown>): this;
|
|
1918
|
-
contains(column: string, value: string | readonly unknown[] | Record<string, unknown>): this;
|
|
1919
|
-
containedBy<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]> | Record<string, unknown>): this;
|
|
1920
|
-
containedBy(column: string, value: string | readonly unknown[] | Record<string, unknown>): this;
|
|
1921
|
-
rangeGt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
1922
|
-
rangeGt(column: string, range: string): this;
|
|
1923
|
-
rangeGte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
1924
|
-
rangeGte(column: string, range: string): this;
|
|
1925
|
-
rangeLt<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
1926
|
-
rangeLt(column: string, range: string): this;
|
|
1927
|
-
rangeLte<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
1928
|
-
rangeLte(column: string, range: string): this;
|
|
1929
|
-
rangeAdjacent<ColumnName extends string & keyof Row>(column: ColumnName, range: string): this;
|
|
1930
|
-
rangeAdjacent(column: string, range: string): this;
|
|
1931
|
-
overlaps<ColumnName extends string & keyof Row>(column: ColumnName, value: string | ReadonlyArray<Row[ColumnName]>): this;
|
|
1932
|
-
overlaps(column: string, value: string | readonly unknown[]): this;
|
|
1933
|
-
textSearch<ColumnName extends string & keyof Row>(column: ColumnName, query: string, options?: {
|
|
1934
|
-
config?: string;
|
|
1935
|
-
type?: 'plain' | 'phrase' | 'websearch';
|
|
1936
|
-
}): this;
|
|
1937
|
-
textSearch(column: string, query: string, options?: {
|
|
1938
|
-
config?: string;
|
|
1939
|
-
type?: 'plain' | 'phrase' | 'websearch';
|
|
1940
|
-
}): this;
|
|
1941
|
-
match<ColumnName extends string & keyof Row>(query: Record<ColumnName, Row[ColumnName]>): this;
|
|
1942
|
-
match(query: Record<string, unknown>): this;
|
|
1943
3138
|
not<ColumnName extends string & keyof Row>(column: ColumnName, operator: 'is', value: null): PostgrestFilterBuilder<ClientOptions, Schema, NonNullableColumn<Row, ColumnName>, NarrowResultColumn<Result$1, ColumnName>, RelationName, Relationships, Method, ThrowOnError> & this;
|
|
1944
3139
|
not<ColumnName extends string & keyof Row>(column: ColumnName, operator: FilterOperator, value: Row[ColumnName]): this;
|
|
1945
3140
|
not(column: string, operator: string, value: unknown): this;
|
|
@@ -2101,6 +3296,119 @@ declare class PostgrestFilterBuilder<ClientOptions extends ClientServerOptions,
|
|
|
2101
3296
|
foreignTable?: string;
|
|
2102
3297
|
referencedTable?: string;
|
|
2103
3298
|
}): this;
|
|
3299
|
+
/**
|
|
3300
|
+
* Match only rows which satisfy the filter. This is an escape hatch - you
|
|
3301
|
+
* should use the specific filter methods wherever possible.
|
|
3302
|
+
*
|
|
3303
|
+
* Unlike most filters, `opearator` and `value` are used as-is and need to
|
|
3304
|
+
* follow [PostgREST
|
|
3305
|
+
* syntax](https://postgrest.org/en/stable/api.html#operators). You also need
|
|
3306
|
+
* to make sure they are properly sanitized.
|
|
3307
|
+
*
|
|
3308
|
+
* @param column - The column to filter on
|
|
3309
|
+
* @param operator - The operator to filter with, following PostgREST syntax
|
|
3310
|
+
* @param value - The value to filter with, following PostgREST syntax
|
|
3311
|
+
*
|
|
3312
|
+
* @category Database
|
|
3313
|
+
* @subcategory Using filters
|
|
3314
|
+
*
|
|
3315
|
+
* @remarks
|
|
3316
|
+
* filter() expects you to use the raw PostgREST syntax for the filter values.
|
|
3317
|
+
*
|
|
3318
|
+
* ```ts
|
|
3319
|
+
* .filter('id', 'in', '(5,6,7)') // Use `()` for `in` filter
|
|
3320
|
+
* .filter('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values
|
|
3321
|
+
* ```
|
|
3322
|
+
*
|
|
3323
|
+
* @example With `select()`
|
|
3324
|
+
* ```ts
|
|
3325
|
+
* const { data, error } = await supabase
|
|
3326
|
+
* .from('characters')
|
|
3327
|
+
* .select()
|
|
3328
|
+
* .filter('name', 'in', '("Han","Yoda")')
|
|
3329
|
+
* ```
|
|
3330
|
+
*
|
|
3331
|
+
* @exampleSql With `select()`
|
|
3332
|
+
* ```sql
|
|
3333
|
+
* create table
|
|
3334
|
+
* characters (id int8 primary key, name text);
|
|
3335
|
+
*
|
|
3336
|
+
* insert into
|
|
3337
|
+
* characters (id, name)
|
|
3338
|
+
* values
|
|
3339
|
+
* (1, 'Luke'),
|
|
3340
|
+
* (2, 'Leia'),
|
|
3341
|
+
* (3, 'Han');
|
|
3342
|
+
* ```
|
|
3343
|
+
*
|
|
3344
|
+
* @exampleResponse With `select()`
|
|
3345
|
+
* ```json
|
|
3346
|
+
* {
|
|
3347
|
+
* "data": [
|
|
3348
|
+
* {
|
|
3349
|
+
* "id": 3,
|
|
3350
|
+
* "name": "Han"
|
|
3351
|
+
* }
|
|
3352
|
+
* ],
|
|
3353
|
+
* "status": 200,
|
|
3354
|
+
* "statusText": "OK"
|
|
3355
|
+
* }
|
|
3356
|
+
* ```
|
|
3357
|
+
*
|
|
3358
|
+
* @example On a referenced table
|
|
3359
|
+
* ```ts
|
|
3360
|
+
* const { data, error } = await supabase
|
|
3361
|
+
* .from('orchestral_sections')
|
|
3362
|
+
* .select(`
|
|
3363
|
+
* name,
|
|
3364
|
+
* instruments!inner (
|
|
3365
|
+
* name
|
|
3366
|
+
* )
|
|
3367
|
+
* `)
|
|
3368
|
+
* .filter('instruments.name', 'eq', 'flute')
|
|
3369
|
+
* ```
|
|
3370
|
+
*
|
|
3371
|
+
* @exampleSql On a referenced table
|
|
3372
|
+
* ```sql
|
|
3373
|
+
* create table
|
|
3374
|
+
* orchestral_sections (id int8 primary key, name text);
|
|
3375
|
+
* create table
|
|
3376
|
+
* instruments (
|
|
3377
|
+
* id int8 primary key,
|
|
3378
|
+
* section_id int8 not null references orchestral_sections,
|
|
3379
|
+
* name text
|
|
3380
|
+
* );
|
|
3381
|
+
*
|
|
3382
|
+
* insert into
|
|
3383
|
+
* orchestral_sections (id, name)
|
|
3384
|
+
* values
|
|
3385
|
+
* (1, 'strings'),
|
|
3386
|
+
* (2, 'woodwinds');
|
|
3387
|
+
* insert into
|
|
3388
|
+
* instruments (id, section_id, name)
|
|
3389
|
+
* values
|
|
3390
|
+
* (1, 2, 'flute'),
|
|
3391
|
+
* (2, 1, 'violin');
|
|
3392
|
+
* ```
|
|
3393
|
+
*
|
|
3394
|
+
* @exampleResponse On a referenced table
|
|
3395
|
+
* ```json
|
|
3396
|
+
* {
|
|
3397
|
+
* "data": [
|
|
3398
|
+
* {
|
|
3399
|
+
* "name": "woodwinds",
|
|
3400
|
+
* "instruments": [
|
|
3401
|
+
* {
|
|
3402
|
+
* "name": "flute"
|
|
3403
|
+
* }
|
|
3404
|
+
* ]
|
|
3405
|
+
* }
|
|
3406
|
+
* ],
|
|
3407
|
+
* "status": 200,
|
|
3408
|
+
* "statusText": "OK"
|
|
3409
|
+
* }
|
|
3410
|
+
* ```
|
|
3411
|
+
*/
|
|
2104
3412
|
filter<ColumnName extends string & keyof Row>(column: ColumnName, operator: `${'' | 'not.'}${FilterOperator}`, value: unknown): this;
|
|
2105
3413
|
filter(column: string, operator: string, value: unknown): this;
|
|
2106
3414
|
}
|
|
@@ -3751,6 +5059,13 @@ declare class PostgrestClient<Database = any, ClientOptions extends ClientServer
|
|
|
3751
5059
|
urlLengthLimit?: number;
|
|
3752
5060
|
retry?: boolean;
|
|
3753
5061
|
});
|
|
5062
|
+
/**
|
|
5063
|
+
* Perform a query on a table or a view.
|
|
5064
|
+
*
|
|
5065
|
+
* @param relation - The table or view name to query
|
|
5066
|
+
*
|
|
5067
|
+
* @category Database
|
|
5068
|
+
*/
|
|
3754
5069
|
from<TableName$1 extends string & keyof Schema['Tables'], Table extends Schema['Tables'][TableName$1]>(relation: TableName$1): PostgrestQueryBuilder<ClientOptions, Schema, Table, TableName$1>;
|
|
3755
5070
|
from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<ClientOptions, Schema, View, ViewName>;
|
|
3756
5071
|
/**
|