[PostgrestClient] When building a query, should the return type only be async throws if we add .execute()?
ssadel opened this issue · comments
Feature request
Is your feature request related to a problem? Please describe.
I'm building a reusable query builder for my application and I was wondering if it was necessary for SupabaseClient.PostgrestClient.PostgrestQueryBuilder to be async and throws without execute being called.
eg.)
This is a compile error because it doesn't precede with try await
:
supabase.database.from("some_table")
Describe the solution you'd like
To me it makes sense if the response doesn't become async or throws until we actually execute the command. Otherwise, we're just storing the query in a var, which doesn't require async at least
eg.)
var query = supabase.database.from("some_table")
then
let response = try await query.execute().data
Additional context
Not sure if this breaks other parks of the SDK or if this is necessary so I apologize if that's the case!
Hey @ssadel thanks for this, that happens because PostgrestClient is an actor, so you need the async
to get access to it.
I will change that so the async
isn't needed, as it is a better interface.
Thanks!