db

package
v0.0.0-...-5ca7c2d Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPendingPayment = models.StatusPendingPayment
	StatusPaid           = models.StatusPaid
	StatusPaymentFailed  = models.StatusPaymentFailed
	StatusExpired        = models.StatusExpired
	StatusShipped        = models.StatusShipped
	StatusDelivered      = models.StatusDelivered
	StatusRefunded       = models.StatusRefunded
)

Variables

View Source
var ErrInvalidStatusTransition = errors.New("invalid order status transition")

Functions

func Connect

func Connect(ctx context.Context, databaseURL string) (*pgxpool.Pool, error)

Types

type Order

type Order = models.Order

type OrderStatus

type OrderStatus = models.OrderStatus

type OrderStore

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

func NewOrderStore

func NewOrderStore(pool *pgxpool.Pool) *OrderStore

func (*OrderStore) Create

func (s *OrderStore) Create(ctx context.Context, order *Order) error

func (*OrderStore) GetByID

func (s *OrderStore) GetByID(ctx context.Context, orderID uuid.UUID) (*Order, error)

func (*OrderStore) GetByShopAndIssue

func (s *OrderStore) GetByShopAndIssue(ctx context.Context, shopID uuid.UUID, issueNumber int) (*Order, error)

func (*OrderStore) GetByStripeSessionID

func (s *OrderStore) GetByStripeSessionID(ctx context.Context, sessionID string) (*Order, error)

func (*OrderStore) GetOrdersByShop

func (s *OrderStore) GetOrdersByShop(ctx context.Context, shopID uuid.UUID, limit int) ([]*Order, error)

func (*OrderStore) MarkDelivered

func (s *OrderStore) MarkDelivered(ctx context.Context, orderID uuid.UUID) error

func (*OrderStore) MarkExpired

func (s *OrderStore) MarkExpired(ctx context.Context, orderID uuid.UUID) error

func (*OrderStore) MarkFailed

func (s *OrderStore) MarkFailed(ctx context.Context, orderID uuid.UUID, reason string) error

func (*OrderStore) MarkPaid

func (s *OrderStore) MarkPaid(ctx context.Context, orderID uuid.UUID, paymentIntentID, customerEmail, customerName string, shippingAddress map[string]any) error

func (*OrderStore) MarkPendingPayment

func (s *OrderStore) MarkPendingPayment(ctx context.Context, orderID uuid.UUID, sessionID string) error

func (*OrderStore) MarkShipped

func (s *OrderStore) MarkShipped(ctx context.Context, orderID uuid.UUID, trackingNumber, carrier string) error

func (*OrderStore) MarkShippedWithoutTracking

func (s *OrderStore) MarkShippedWithoutTracking(ctx context.Context, orderID uuid.UUID) error

func (*OrderStore) UpdateShipmentDetails

func (s *OrderStore) UpdateShipmentDetails(ctx context.Context, orderID uuid.UUID, trackingNumber, carrier string) error

func (*OrderStore) UpdateStripeSession

func (s *OrderStore) UpdateStripeSession(ctx context.Context, orderID uuid.UUID, sessionID string) error

type Shop

type Shop = models.Shop

type ShopStore

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

func NewShopStore

func NewShopStore(pool *pgxpool.Pool, encryptor crypto.Encryptor) (*ShopStore, error)

func (*ShopStore) CountShopsByInstallationID

func (s *ShopStore) CountShopsByInstallationID(ctx context.Context, installationID int64) (int, error)

func (*ShopStore) Create

func (s *ShopStore) Create(ctx context.Context, installationID int64, repoID int64, repoFullName, ownerEmail string) (*Shop, error)

func (*ShopStore) DisconnectShop

func (s *ShopStore) DisconnectShop(ctx context.Context, installationID int64, repoID int64) error

func (*ShopStore) GetByID

func (s *ShopStore) GetByID(ctx context.Context, id uuid.UUID) (*Shop, error)

func (*ShopStore) GetByInstallationAndRepoID

func (s *ShopStore) GetByInstallationAndRepoID(ctx context.Context, installationID int64, repoID int64) (*Shop, error)

func (*ShopStore) GetByInstallationID

func (s *ShopStore) GetByInstallationID(ctx context.Context, installationID int64) (*Shop, error)

func (*ShopStore) GetByRepoID

func (s *ShopStore) GetByRepoID(ctx context.Context, repoID int64) (*Shop, error)

func (*ShopStore) GetConnectedShopsByInstallationID

func (s *ShopStore) GetConnectedShopsByInstallationID(ctx context.Context, installationID int64) ([]*Shop, error)

func (*ShopStore) GetDistinctInstallationIDs

func (s *ShopStore) GetDistinctInstallationIDs(ctx context.Context) ([]int64, error)

func (*ShopStore) GetFirstConfiguredShop

func (s *ShopStore) GetFirstConfiguredShop(ctx context.Context, installationID int64) (*Shop, error)

func (*ShopStore) GetShopsByInstallationID

func (s *ShopStore) GetShopsByInstallationID(ctx context.Context, installationID int64) ([]*Shop, error)

func (*ShopStore) MarkOnboarded

func (s *ShopStore) MarkOnboarded(ctx context.Context, shopID uuid.UUID) error

func (*ShopStore) ReconnectShop

func (s *ShopStore) ReconnectShop(ctx context.Context, installationID int64, repoID int64) error

func (*ShopStore) SuspendShop

func (s *ShopStore) SuspendShop(ctx context.Context, installationID int64, repoID int64) error

func (*ShopStore) UnsuspendShop

func (s *ShopStore) UnsuspendShop(ctx context.Context, installationID int64, repoID int64) error

func (*ShopStore) UpdateEmailConfig

func (s *ShopStore) UpdateEmailConfig(ctx context.Context, shopID uuid.UUID, provider string, config map[string]any, verified bool) error

func (*ShopStore) UpdateRepoFullName

func (s *ShopStore) UpdateRepoFullName(ctx context.Context, shopID uuid.UUID, repoFullName string) error

func (*ShopStore) UpdateStripeConnectAccount

func (s *ShopStore) UpdateStripeConnectAccount(ctx context.Context, shopID uuid.UUID, connectAccountID string) error

func (*ShopStore) UpdateStripeConnectDetails

func (s *ShopStore) UpdateStripeConnectDetails(ctx context.Context, shopID uuid.UUID, accountID string, detailsSubmitted, chargesEnabled, payoutsEnabled bool) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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