Kotlin: Update data

Examples

Updating your data

supabase.postgrest["countries"].update(
    \{
       Country::name setTo "Australia"
       //or
       set("name", "Australia")
    \}
) \{
   Country::id eq 1
   //or
   eq("id", 1)
\}

Update a record and return it

val newCountry = supabase.postgrest["countries"].update(
    \{
       Country::name setTo "Australia"
       //or
       set("name", "Australia")
    \}
) \{
   Country::id eq 1
   //or
   eq("id", 1)
\}.decodeSingle<Country>()

Updating JSON data

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>()