update()
should always be combined with a filter block to avoid updating all records.insert
or update
, you have to provide a serializable value in the function parameter.supabase.postgrest["countries"].update(
\{
Country::name setTo "Australia"
//or
set("name", "Australia")
\}
) \{
Country::id eq 1
//or
eq("id", 1)
\}
val newCountry = supabase.postgrest["countries"].update(
\{
Country::name setTo "Australia"
//or
set("name", "Australia")
\}
) \{
Country::id eq 1
//or
eq("id", 1)
\}.decodeSingle<Country>()
val address = Address(street = "Melrose Place", postcode = 90210)
supabase.postgrest["users"].update(
\{
User::address setTo address
\}
) \{
User::id eq 1
//or
eq("address->postcode", 90210)
\}.decodeSingle<Country>()