Kotlin: Update data

Parameters

Examples

Updating your data

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

Update a record and return it

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

Updating JSON data

val address = Address(street = "Melrose Place", postcode = 90210)
supabase.from("users").update(
    \{
       User::address setTo address
    \}
) \{
    filter \{
        eq("address->postcode", 90210)
    \}
\}