phpsupabase icon indicating copy to clipboard operation
phpsupabase copied to clipboard

Add support for RCP

Open PoeHaH opened this issue 2 years ago • 2 comments

Hi @rafaelwendel

I am using your library in a project where I need to run some advanced queries containing aggregates etc. The createCustomQuery function does not cover this (neither does the equivalent in Supabase itself).

To get around that, I am creating database functions via the Supabase UI and using their RPC API endpoint to execute the function and return the results. This works well!

RPC is not part of your library so I am manuallyu calling it this way:

$service = self::get_service( 'rest' );
$result = $service->executeHttpRequest( 'GET', $my_base_url . 'rpc/function_name', [ 'headers' => $service->getHeaders() ] );

This works without issue, but it would be cleaner if your library had a function to call RPC directly. Perhaps you can consider to include it in a next update? Thanks!

PoeHaH avatar Nov 07 '22 16:11 PoeHaH