For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.
update() should always be combined with Filters to target the item(s) you wish to update.update() returns no rows by default. Add select() after the filters to get the updated rows back.try await supabase
.from("instruments")
.update(["name": "piano"])
.eq("id", value: 1)
.execute()
struct Instrument: Decodable {
let id: Int
let name: String
}
let instrument: Instrument = try await supabase
.from("instruments")
.update(["name": "piano"])
.eq("id", value: 1)
.select()
// If you know this query should return a single object, append a `single()` modifier to it.
.single()
.execute()
.value
struct User: Decodable {
let id: Int
let name: String
let address: Address
struct Address: Codable {
let street: String
let postcode: String
}
}
struct UpdateUser: Encodable {
let address: User.Address
}
let users: [User] = try await supabase
.from("users")
.update(
UpdateUser(
address: .init(
street: "Melrose Place",
postcode: "90210"
)
)
)
.eq("address->postcode", value: "90210")
.select()
.execute()
.value