Perform a SELECT query on the table or view.
decode
method, you have to provide a serializable class as the type parameter.Columns
object to select specific columns.val city = supabase.postgrest["cities"].select().decodeSingle<City>()
val city = supabase.postgrest["cities"].select(columns = Columns.list("id, name")).decodeSingle<City>()
val country = supabase.postgrest["countries"]
.select(
columns = Columns.raw(
"""
id,
name,
cities (
id,
name
)
""")
)
.decodeSingle<Country>()
val message = supabase.postgrest["messages"]
.select(columns = Columns.raw(
"""
content,
from: sender_id(name),
to: receiver_id(name)
"""))
.decodeSingle<Message>()
val count = supabase.postgrest["countries"]
.select(head = true, count = Count.EXACT)
.count()!!
val user = supabase.postgrest["users"]
.select(columns = Columns.raw(
"""
id, name
address->city
""")
.decodeSingle<User>()