supabase

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package supabase provides an ExecutionBackend implementation for Supabase (Postgres-compatible) with native pgxpool, pooler-mode awareness, RLS context injection, and internal schema filtering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithJWT

func WithJWT(ctx context.Context, claims map[string]interface{}) context.Context

WithJWT attaches JWT claims to a context for RLS-scoped query execution. When a query is executed with this context on an RLS-enabled backend, the claims are injected via set_config('request.jwt.claims', ...) before the query runs, allowing Supabase RLS policies to evaluate them.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend implements fabric.ExecutionBackend for Supabase projects.

func NewBackend

func NewBackend(ctx context.Context, name string, config *loomv1.SupabaseConnection, logger *zap.Logger) (*Backend, error)

NewBackend creates a new Supabase backend from configuration.

func (*Backend) Capabilities

func (b *Backend) Capabilities() *fabric.Capabilities

Capabilities returns the backend's capabilities.

func (*Backend) Close

func (b *Backend) Close() error

Close releases the connection pool.

func (*Backend) ExecuteCustomOperation

func (b *Backend) ExecuteCustomOperation(ctx context.Context, op string, params map[string]interface{}) (interface{}, error)

ExecuteCustomOperation handles Supabase-specific operations.

func (*Backend) ExecuteQuery

func (b *Backend) ExecuteQuery(ctx context.Context, query string) (*fabric.QueryResult, error)

ExecuteQuery executes a SQL query against the Supabase database. If RLS is enabled and JWT claims are present in the context, the query is wrapped in an RLS-scoped transaction.

func (*Backend) GetMetadata

func (b *Backend) GetMetadata(ctx context.Context, resource string) (map[string]interface{}, error)

GetMetadata retrieves metadata for a resource.

func (*Backend) GetSchema

func (b *Backend) GetSchema(ctx context.Context, resource string) (*fabric.Schema, error)

GetSchema retrieves column information for a table.

func (*Backend) ListResources

func (b *Backend) ListResources(ctx context.Context, filters map[string]string) ([]fabric.Resource, error)

ListResources lists user-visible tables, excluding Supabase internal schemas.

func (*Backend) Name

func (b *Backend) Name() string

Name returns the backend identifier.

func (*Backend) Ping

func (b *Backend) Ping(ctx context.Context) error

Ping checks connectivity to the Supabase database.

func (*Backend) Pool

func (b *Backend) Pool() *pgxpool.Pool

Pool returns the underlying pgxpool.Pool for advanced usage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL