pgrepo

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

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

func New

func New(pool *pgxpool.Pool) *Repo

func (*Repo) ChangeWorkspacePlan

func (r *Repo) ChangeWorkspacePlan(ctx context.Context, workspaceID, toPlan, actor, reason string, now time.Time, inTx func(pgx.Tx, string) error) error

func (*Repo) CreateOrder

func (r *Repo) CreateOrder(ctx context.Context, o domain.Order) (domain.Order, error)

func (*Repo) ExpireDueWorkspaces

func (r *Repo) ExpireDueWorkspaces(ctx context.Context, now time.Time, limit int) ([]app.ExpiredWorkspace, error)

func (*Repo) FailOrder

func (r *Repo) FailOrder(ctx context.Context, o domain.Order, e domain.PaymentEvent, emit func(pgx.Tx) error, now time.Time) error

func (*Repo) FindOrderByChannelRef

func (r *Repo) FindOrderByChannelRef(ctx context.Context, channel, channelRef string) (domain.Order, bool, error)

func (*Repo) FindOrderByPaymentIntent

func (r *Repo) FindOrderByPaymentIntent(ctx context.Context, paymentIntentRef string) (domain.Order, bool, error)

func (*Repo) FindWorkspaceBySubscription

func (r *Repo) FindWorkspaceBySubscription(ctx context.Context, subscriptionRef string) (string, string, bool, error)

func (*Repo) GetMeter

func (r *Repo) GetMeter(ctx context.Context, slug string) (app.Meter, bool, error)

func (*Repo) GetOrder

func (r *Repo) GetOrder(ctx context.Context, id string) (domain.Order, bool, error)

func (*Repo) GetPlan

func (r *Repo) GetPlan(ctx context.Context, code string) (domain.Plan, bool, error)

func (*Repo) GetWorkspacePlan

func (r *Repo) GetWorkspacePlan(ctx context.Context, workspaceID string) (string, error)

func (*Repo) GetWorkspaceSubscription

func (r *Repo) GetWorkspaceSubscription(ctx context.Context, workspaceID string) (string, bool, error)

func (*Repo) InsertOverageOrder

func (r *Repo) InsertOverageOrder(ctx context.Context, o domain.Order) (domain.Order, bool, error)

func (*Repo) InsertPaymentEvent

func (r *Repo) InsertPaymentEvent(ctx context.Context, e domain.PaymentEvent) (bool, error)

func (*Repo) LatestPaidOrderInterval

func (r *Repo) LatestPaidOrderInterval(ctx context.Context, workspaceID string) (string, bool, error)

func (*Repo) ListAllOrders

func (r *Repo) ListAllOrders(ctx context.Context, f app.AdminOrderFilter, limit, offset int) ([]app.AdminOrderView, int, error)

func (*Repo) ListMeteredWorkspaces

func (r *Repo) ListMeteredWorkspaces(ctx context.Context, limit int) ([]app.MeteredWorkspace, error)

func (*Repo) ListMeters

func (r *Repo) ListMeters(ctx context.Context) ([]app.Meter, error)

func (*Repo) ListOrdersByWorkspace

func (r *Repo) ListOrdersByWorkspace(ctx context.Context, workspaceID string, limit int) ([]domain.Order, error)

func (*Repo) ListPaymentEvents

func (r *Repo) ListPaymentEvents(ctx context.Context, f app.PaymentEventFilter, limit, offset int) ([]app.PaymentEventView, int, error)

func (*Repo) ListPlanCodes

func (r *Repo) ListPlanCodes(ctx context.Context) ([]string, error)

func (*Repo) ListPlans

func (r *Repo) ListPlans(ctx context.Context) ([]domain.Plan, error)

func (*Repo) MarkEventError

func (r *Repo) MarkEventError(ctx context.Context, channel, channelEventID, processErr string) error

func (*Repo) MarkEventProcessed

func (r *Repo) MarkEventProcessed(ctx context.Context, channel, channelEventID string) error

func (*Repo) PayOrder

func (r *Repo) PayOrder(ctx context.Context, id string, emit func(pgx.Tx) error, now time.Time) error

func (*Repo) RegisterMeter

func (r *Repo) RegisterMeter(ctx context.Context, m app.Meter) error

func (*Repo) SetOrderChannelRef

func (r *Repo) SetOrderChannelRef(ctx context.Context, id, channelRef string) error

func (*Repo) SetOrderPaymentIntentRef

func (r *Repo) SetOrderPaymentIntentRef(ctx context.Context, orderID, paymentIntentRef string) error

func (*Repo) SetWorkspaceSubscription

func (r *Repo) SetWorkspaceSubscription(ctx context.Context, workspaceID, subscriptionRef string, expiresAt, now time.Time) error

func (*Repo) UpdateOrderStatus

func (r *Repo) UpdateOrderStatus(ctx context.Context, id string, from, to domain.OrderStatus, now time.Time) error

func (*Repo) UpdatePlan added in v0.8.0

func (r *Repo) UpdatePlan(ctx context.Context, code, name, limitsJSON string, sortNo int, currency string) (found bool, err error)

UpdatePlan full-replaces the editable columns of a plan (the code in the WHERE clause is the immutable identity). found reports whether a row matched; false means the caller turns it into a not-found error.

Jump to

Keyboard shortcuts

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