Skip to content

Add Rest() and RestError() methods - Fixes #29#46

Open
AdvaitP-1 wants to merge 1 commit into
supabase-community:mainfrom
AdvaitP-1:feature/access-rest-client-error
Open

Add Rest() and RestError() methods - Fixes #29#46
AdvaitP-1 wants to merge 1 commit into
supabase-community:mainfrom
AdvaitP-1:feature/access-rest-client-error

Conversation

@AdvaitP-1

Copy link
Copy Markdown

What kind of change does this PR introduce?

Feature - Adds methods to access the underlying PostgREST client and its error state

What is the current behavior?

The rest field in the Client struct is private, so users can't:

  • Call PostgREST methods like ChangeSchema() directly
  • Access the ClientError from the PostgREST client
  • Write custom wrappers that need direct client access

This addresses issue #29

What is the new behavior?

Added two new methods:

  • Rest() - Returns the underlying PostgREST client for direct access:
    restClient := client.Rest()
    restClient.ChangeSchema("custom_schema")

  • RestError() - Returns the last error from the PostgREST client:
    if err := client.RestError(); err != nil {
    log.Printf("PostgREST error: %v", err)
    }

…lient as well as the client errors. Included unit tests for the new methods and updated the README with usage examples---Fixes issue supabase-community#29 Access to Rest Client or ClientError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant