Kotlin: Upsert data

Examples

Upsert your data

val toUpsert = Message(id = 3, message = "foo", username = "supabot")
supabase.postgrest["messages"].insert(toUpsert, upsert = true)

Upserting into tables with constraints

let toUpsert = User(username = "supabot")
supabase.postgrest["users"].insert(toUpsert, upsert = true, onConflict = "username")

Return the exact number of rows

let toUpsert = User(username = "supabot")
val count = supabase.postgrest["users"].insert(toUpsert, upsert = true, onConflict = "username", count = Count.EXACT).count()