golazy.dev golazy.dev / pg / pgstorage Index | Files

package pgstorage

import "golazy.dev/pg/pgstorage"

Package pgstorage implements a PostgreSQL object store for golazy.dev/lazystorage.

The storage satisfies read, write, delete, and list interfaces, so it can also be used as the target for lazyassets uploads.

Functions

Types

type Storage

type Storage struct {
	// contains filtered or unexported fields
}
func New

New creates a PostgreSQL-backed object store.

func New(pool *pgxpool.Pool) *Storage
func (storage *Storage) Delete
func (storage *Storage) Delete(ctx context.Context, key string, options ...any) ([]any, error)
func (storage *Storage) List
func (storage *Storage) List(ctx context.Context, prefix string, options ...any) (lazystorage.Iterator, []any, error)
func (storage *Storage) Open
func (storage *Storage) Open(ctx context.Context, key string, options ...any) (lazystorage.File, []any, error)
func (storage *Storage) Put
func (storage *Storage) Put(ctx context.Context, key string, body io.Reader, options ...any) (lazystorage.Info, []any, error)