supabase

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements the DataStore interface for Supabase

func New

func New(url string, apiKey string, options ...Option) (*Client, error)

New creates a new Supabase client

func (*Client) Close

func (c *Client) Close() error

Close closes the database connection

func (*Client) Collection

func (c *Client) Collection(name string) interfaces.CollectionRef

Collection returns a reference to a specific collection/table

func (*Client) Transaction

func (c *Client) Transaction(ctx context.Context, fn func(tx interfaces.Transaction) error) error

Transaction executes multiple operations in a transaction

type Collection

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

Collection represents a reference to a collection/table

func (*Collection) Delete

func (c *Collection) Delete(ctx context.Context, id string) error

Delete deletes a document by ID

func (*Collection) Get

func (c *Collection) Get(ctx context.Context, id string) (map[string]interface{}, error)

Get retrieves a document by ID

func (*Collection) Insert

func (c *Collection) Insert(ctx context.Context, data map[string]interface{}) (string, error)

Insert inserts a document into the collection

func (*Collection) Query

func (c *Collection) Query(ctx context.Context, filter map[string]interface{}, options ...interfaces.QueryOption) ([]map[string]interface{}, error)

Query queries documents in the collection

func (*Collection) Update

func (c *Collection) Update(ctx context.Context, id string, data map[string]interface{}) error

Update updates a document by ID

type Option

type Option func(*Client)

Option represents an option for configuring the client

func WithDB

func WithDB(db *sql.DB) Option

WithDB sets the SQL database connection

type Transaction

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

Transaction represents a database transaction

func (*Transaction) Collection

func (t *Transaction) Collection(name string) interfaces.CollectionRef

Collection returns a reference to a specific collection/table within the transaction

func (*Transaction) Commit

func (t *Transaction) Commit() error

Commit commits the transaction

func (*Transaction) Rollback

func (t *Transaction) Rollback() error

Rollback rolls back the transaction

type TransactionCollection

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

TransactionCollection represents a collection within a transaction

func (*TransactionCollection) Delete

func (c *TransactionCollection) Delete(ctx context.Context, id string) error

Delete deletes a document by ID within a transaction

func (*TransactionCollection) Get

func (c *TransactionCollection) Get(ctx context.Context, id string) (map[string]interface{}, error)

Get retrieves a document by ID within a transaction

func (*TransactionCollection) Insert

func (c *TransactionCollection) Insert(ctx context.Context, data map[string]interface{}) (string, error)

Insert inserts a document into the collection within a transaction

func (*TransactionCollection) Query

func (c *TransactionCollection) Query(ctx context.Context, filter map[string]interface{}, options ...interfaces.QueryOption) ([]map[string]interface{}, error)

Query queries documents in the collection within a transaction

func (*TransactionCollection) Update

func (c *TransactionCollection) Update(ctx context.Context, id string, data map[string]interface{}) error

Update updates a document by ID within a transaction

Jump to

Keyboard shortcuts

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