Search code examples
supabasepostgrest

Problems using ‘eq’ in a postgrest request


I'm trying to retrieve, in a query, the information for the logged-in user from the users table in my database on supabase. Here's what I do:

val response = supabaseClient.postgrest[‘users’]
                    .select {
                        User::id eq userId
                    }
                    .decodeSingle<User>()

But I get this error: Unresolved reference: eq I have supabase:postgrest-kt version 3.0.3. On the doc it seems that the use of ‘eq’ is ok. I don't see what the problem is. Thank you


Solution

  • You should use eq inside of the filter, not the select.

    filter {
      User::id eq userId
    }
    

    The docs mention it in the Using Filters section.