Class PostgrestQuery
A PostgREST query or write on one table, built with chained calls and
sent by execute().
Filters apply to selects, updates and deletes. Values are sent as text; PostgREST converts them to the column type.
Supabase supabase = new Supabase("https://xyzcompany.supabase.co", "public-anon-key");
Map<String, Object> row = new HashMap<String, Object>();
row.put("name", "Denmark");
supabase.from("countries").insert(row).returning(true).execute();
supabase.from("countries").delete().eq("name", "Atlantis").execute();
-
Method Summary
Modifier and TypeMethodDescriptionThe request headersexecute()adds to the auth headers.buildUrl()The request URLexecute()sends, query string included.delete()Deletes the rows that match the filters.Column equals value.execute()Sends the request.The HTTP methodexecute()sends.Column is greater than value.Column is greater than or equal to value.Case insensitive pattern match.Column is one of the values.Inserts a row (Map) or rows (Listof maps).ColumnISa value:null,trueorfalse.Case sensitive pattern match.limit(int count) Returns at mostcountrows.Column is less than value.Column is less than or equal to value.Column does not equal value.Sorts by a column.range(int from, int to) Returns rowsfromtoto, both inclusive and zero based.returning(boolean returning) Asks a write to return the affected rows.Chooses the columns to return,*by default.Updates the rows that match the filters.Inserts rows or merges them into existing rows with the same key.
-
Method Details
-
select
Chooses the columns to return,
*by default. Embedded resources work too:id,name,cities(name).Parameters
columns: the column list
Returns
this query
-
eq
Column equals value.
Parameters
-
column: the column -
value: the value
Returns
this query
-
-
neq
Column does not equal value.
Parameters
-
column: the column -
value: the value
Returns
this query
-
-
gt
Column is greater than value.
Parameters
-
column: the column -
value: the value
Returns
this query
-
-
gte
Column is greater than or equal to value.
Parameters
-
column: the column -
value: the value
Returns
this query
-
-
lt
Column is less than value.
Parameters
-
column: the column -
value: the value
Returns
this query
-
-
lte
Column is less than or equal to value.
Parameters
-
column: the column -
value: the value
Returns
this query
-
-
like
Case sensitive pattern match. Use
*or%as the wildcard.Parameters
-
column: the column -
pattern: the pattern
Returns
this query
-
-
ilike
Case insensitive pattern match.
Parameters
-
column: the column -
pattern: the pattern
Returns
this query
-
-
is
Column
ISa value:null,trueorfalse.Parameters
-
column: the column -
value:null,trueorfalse
Returns
this query
-
-
in
Column is one of the values. Values with commas, quotes or parentheses are quoted.
Parameters
-
column: the column -
values: the values
Returns
this query
-
-
order
Sorts by a column. Call again for secondary sorts.
Parameters
-
column: the column -
ascending: the direction
Returns
this query
-
-
limit
Returns at most
countrows.Parameters
count: the row limit
Returns
this query
-
range
Returns rows
fromtoto, both inclusive and zero based.Parameters
-
from: the first row -
to: the last row
Returns
this query
-
-
insert
Inserts a row (
Map) or rows (Listof maps).Parameters
rows: a map or a list of maps
Returns
this query
-
upsert
Inserts rows or merges them into existing rows with the same key.
Parameters
-
rows: a map or a list of maps -
onConflictColumns: the unique columns to match on, or null for the primary key
Returns
this query
-
-
update
Updates the rows that match the filters.
Parameters
values: the columns to change
Returns
this query
-
delete
Deletes the rows that match the filters.
Returns
this query
-
returning
Asks a write to return the affected rows. Off by default.
Parameters
returning: true to return the rows
Returns
this query
-
getMethod
The HTTP method
execute()sends.Returns
the method
-
buildUrl
The request URL
execute()sends, query string included.Returns
the URL
-
buildHeaders
-
execute
Sends the request.
Returns
the rows; empty for a write without
returning(true)
-