postgres

package
v0.0.0-...-6e56996 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package postgres provides a Postgres-backed CMS store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store implements store.TenantAdminStore and store.PageStore using Postgres.

func New

func New(ctx context.Context, databaseURL string) (*Store, error)

New opens a Postgres store using databaseURL.

func NewWithPool

func NewWithPool(pool *pgxpool.Pool) *Store

NewWithPool wraps an existing pgx pool.

func (*Store) Close

func (s *Store) Close()

Close closes the owned pool.

func (*Store) Create

func (s *Store) Create(ctx context.Context, tenantID int64, p *store.Page) error

Create inserts a page.

func (*Store) CreateDomain

func (s *Store) CreateDomain(ctx context.Context, d *store.Domain) error

CreateDomain inserts a tenant domain.

func (*Store) CreateTenant

func (s *Store) CreateTenant(ctx context.Context, t *store.Tenant) error

CreateTenant inserts a tenant.

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, tenantID int64, id int64) error

Delete removes a tenant-scoped page.

func (*Store) DeleteDomain

func (s *Store) DeleteDomain(ctx context.Context, tenantID, id int64) error

DeleteDomain deletes a tenant-owned domain.

func (*Store) DeleteTenant

func (s *Store) DeleteTenant(ctx context.Context, id int64) error

DeleteTenant deletes a tenant.

func (*Store) Get

func (s *Store) Get(ctx context.Context, tenantID int64, id int64) (*store.Page, error)

Get returns a tenant-scoped page by ID.

func (*Store) GetByPath

func (s *Store) GetByPath(ctx context.Context, tenantID int64, subsite, path string) (*store.Page, error)

GetByPath returns a tenant-scoped page by subsite and path.

func (*Store) GetTenant

func (s *Store) GetTenant(ctx context.Context, id int64) (*store.Tenant, error)

GetTenant returns a tenant by ID.

func (*Store) List

func (s *Store) List(ctx context.Context, tenantID int64, subsite string) ([]*store.Page, error)

List returns pages for a tenant, optionally filtered by subsite.

func (*Store) ListDomains

func (s *Store) ListDomains(ctx context.Context, tenantID int64) ([]*store.Domain, error)

ListDomains returns domains for a tenant.

func (*Store) ListTenants

func (s *Store) ListTenants(ctx context.Context) ([]*store.Tenant, error)

ListTenants returns all tenants.

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping verifies DB reachability.

func (*Store) Update

func (s *Store) Update(ctx context.Context, tenantID int64, p *store.Page) error

Update writes a tenant-scoped page.

func (*Store) UpdateTenant

func (s *Store) UpdateTenant(ctx context.Context, t *store.Tenant) error

UpdateTenant updates a tenant.

Jump to

Keyboard shortcuts

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