Documentation
¶
Index ¶
- type AssetRepo
- func (r *AssetRepo) Delete(ctx context.Context, id string) error
- func (r *AssetRepo) FindByID(ctx context.Context, id string) (*media.Asset, error)
- func (r *AssetRepo) List(ctx context.Context, offset, limit int) ([]media.Asset, error)
- func (r *AssetRepo) Save(ctx context.Context, a *media.Asset) error
- type AuditLogRepo
- func (r *AuditLogRepo) DeleteBefore(ctx context.Context, cutoff time.Time) (int64, error)
- func (r *AuditLogRepo) Insert(ctx context.Context, record domainadmin.AuditLogRecord) error
- func (r *AuditLogRepo) List(ctx context.Context, filter domainadmin.AuditLogFilter) ([]domainadmin.AuditLogRecord, error)
- type CacheStore
- func (s *CacheStore) CompareAndSubtract(key string, expected int64) (int64, error)
- func (s *CacheStore) Delete(key string) error
- func (s *CacheStore) DeleteByPrefix(ctx context.Context, prefix string) error
- func (s *CacheStore) DeleteExpired(ctx context.Context) (int64, error)
- func (s *CacheStore) Get(key string, dest any) (bool, error)
- func (s *CacheStore) Incr(key string, delta int64, ttl time.Duration) (int64, error)
- func (s *CacheStore) Set(key string, value any, ttl time.Duration) error
- type CartRepo
- func (r *CartRepo) Delete(ctx context.Context, id string) error
- func (r *CartRepo) FindActiveByCustomerID(ctx context.Context, customerID string) (*cart.Cart, error)
- func (r *CartRepo) FindByID(ctx context.Context, id string) (*cart.Cart, error)
- func (r *CartRepo) FindRecoveryCandidates(ctx context.Context, staleBefore time.Time, limit int) ([]*cart.Cart, error)
- func (r *CartRepo) MarkRecoveryEmailSent(ctx context.Context, cartID string, sentAt time.Time) (bool, error)
- func (r *CartRepo) Save(ctx context.Context, c *cart.Cart) error
- type CategoryRepo
- func (r *CategoryRepo) Create(ctx context.Context, c *catalog.Category) error
- func (r *CategoryRepo) Delete(ctx context.Context, id string) error
- func (r *CategoryRepo) FindAll(ctx context.Context) ([]catalog.Category, error)
- func (r *CategoryRepo) FindByID(ctx context.Context, id string) (*catalog.Category, error)
- func (r *CategoryRepo) FindByParentID(ctx context.Context, parentID *string) ([]catalog.Category, error)
- func (r *CategoryRepo) FindBySlug(ctx context.Context, slug string) (*catalog.Category, error)
- func (r *CategoryRepo) Update(ctx context.Context, c *catalog.Category) error
- type CollectionRepo
- func (r *CollectionRepo) AddProduct(ctx context.Context, collectionID, productID string) error
- func (r *CollectionRepo) Create(ctx context.Context, c *catalog.Collection) error
- func (r *CollectionRepo) FindByID(ctx context.Context, id string) (*catalog.Collection, error)
- func (r *CollectionRepo) FindBySlug(ctx context.Context, slug string) (*catalog.Collection, error)
- func (r *CollectionRepo) List(ctx context.Context) ([]catalog.Collection, error)
- func (r *CollectionRepo) ListProductIDs(ctx context.Context, collectionID string) ([]string, error)
- func (r *CollectionRepo) RemoveProduct(ctx context.Context, collectionID, productID string) error
- func (r *CollectionRepo) Update(ctx context.Context, c *catalog.Collection) error
- type ConfigRepo
- func (r *ConfigRepo) All(ctx context.Context) ([]domainCfg.Entry, error)
- func (r *ConfigRepo) Delete(ctx context.Context, key string) error
- func (r *ConfigRepo) Get(ctx context.Context, key string) (interface{}, error)
- func (r *ConfigRepo) Set(ctx context.Context, key string, value interface{}) error
- func (r *ConfigRepo) SetMany(ctx context.Context, entries map[string]interface{}) error
- type ConsentRepo
- func (r *ConsentRepo) DeleteByCustomerID(ctx context.Context, customerID string) error
- func (r *ConsentRepo) FindByCustomerID(ctx context.Context, customerID string) (*legal.Consent, error)
- func (r *ConsentRepo) Upsert(ctx context.Context, c *legal.Consent) error
- func (r *ConsentRepo) WithTx(tx *sql.Tx) legal.ConsentRepository
- type ContentBlockRepo
- func (r *ContentBlockRepo) Create(ctx context.Context, block *cms.ContentBlock) error
- func (r *ContentBlockRepo) Delete(ctx context.Context, blockID string) error
- func (r *ContentBlockRepo) FindActiveBlocksByTarget(ctx context.Context, targetType cms.TargetType, targetKey string) ([]*cms.ContentBlock, error)
- func (r *ContentBlockRepo) FindBlocksByTarget(ctx context.Context, targetType cms.TargetType, targetKey string) ([]*cms.ContentBlock, error)
- func (r *ContentBlockRepo) FindByID(ctx context.Context, blockID string) (*cms.ContentBlock, error)
- func (r *ContentBlockRepo) List(ctx context.Context, offset, limit int) ([]*cms.ContentBlock, error)
- func (r *ContentBlockRepo) SaveTargetPlacements(ctx context.Context, targetType cms.TargetType, targetKey string, ...) error
- func (r *ContentBlockRepo) Update(ctx context.Context, block *cms.ContentBlock) error
- type ContentTranslationRepo
- func (r *ContentTranslationRepo) DeleteByEntity(ctx context.Context, entityID string) error
- func (r *ContentTranslationRepo) FindByEntityAndLanguage(ctx context.Context, entityID, language string) ([]translation.ContentTranslation, error)
- func (r *ContentTranslationRepo) FindFieldValue(ctx context.Context, entityID, language, field string) (*translation.ContentTranslation, error)
- func (r *ContentTranslationRepo) Upsert(ctx context.Context, ct *translation.ContentTranslation) error
- type CouponRepo
- func (r *CouponRepo) Delete(ctx context.Context, id string) error
- func (r *CouponRepo) FindByCode(ctx context.Context, code string) (*promotion.Coupon, error)
- func (r *CouponRepo) FindByID(ctx context.Context, id string) (*promotion.Coupon, error)
- func (r *CouponRepo) List(ctx context.Context, offset, limit int) ([]promotion.Coupon, error)
- func (r *CouponRepo) ListByPromotion(ctx context.Context, promotionID string) ([]promotion.Coupon, error)
- func (r *CouponRepo) Save(ctx context.Context, c *promotion.Coupon) error
- func (r *CouponRepo) WithTx(tx *sql.Tx) *CouponRepo
- type CreditNoteRepo
- type CustomerAddressRepo
- func (r *CustomerAddressRepo) Create(ctx context.Context, a *customer.Address) error
- func (r *CustomerAddressRepo) Delete(ctx context.Context, customerID, addressID string) error
- func (r *CustomerAddressRepo) FindByID(ctx context.Context, id string) (*customer.Address, error)
- func (r *CustomerAddressRepo) FindDefault(ctx context.Context, customerID string) (*customer.Address, error)
- func (r *CustomerAddressRepo) ListByCustomer(ctx context.Context, customerID string) ([]customer.Address, error)
- func (r *CustomerAddressRepo) SetDefault(ctx context.Context, customerID, addressID string) error
- func (r *CustomerAddressRepo) Update(ctx context.Context, a *customer.Address) error
- type CustomerRepo
- func (r *CustomerRepo) BumpTokenGeneration(ctx context.Context, customerID string) error
- func (r *CustomerRepo) ChangePasswordAndBumpTokenGeneration(ctx context.Context, customerID, passwordHash string) error
- func (r *CustomerRepo) Create(ctx context.Context, c *customer.Customer) error
- func (r *CustomerRepo) Delete(ctx context.Context, id string) error
- func (r *CustomerRepo) FindByEmail(ctx context.Context, email string) (*customer.Customer, error)
- func (r *CustomerRepo) FindByID(ctx context.Context, id string) (*customer.Customer, error)
- func (r *CustomerRepo) HasActiveAdmin(ctx context.Context) (bool, error)
- func (r *CustomerRepo) ListAdminUsers(ctx context.Context, offset, limit int) ([]customer.Customer, error)
- func (r *CustomerRepo) ListCustomers(ctx context.Context, offset, limit int) ([]customer.Customer, error)
- func (r *CustomerRepo) Update(ctx context.Context, c *customer.Customer) error
- func (r *CustomerRepo) UpdateAdminUser(ctx context.Context, c *customer.Customer, priorRole customer.Role, ...) error
- func (r *CustomerRepo) WithTx(tx *sql.Tx) customer.CustomerRepository
- type ExtensionFieldRepo
- func (r *ExtensionFieldRepo) Create(ctx context.Context, field domainext.ExtensionField) error
- func (r *ExtensionFieldRepo) FindByCode(ctx context.Context, code string) (domainext.ExtensionField, error)
- func (r *ExtensionFieldRepo) ListActive(ctx context.Context, scope domainext.TargetType) ([]domainext.ExtensionField, error)
- func (r *ExtensionFieldRepo) Save(ctx context.Context, field domainext.ExtensionField) error
- func (r *ExtensionFieldRepo) SoftDelete(ctx context.Context, code string) error
- type ExtensionValueRepo
- func (r *ExtensionValueRepo) Delete(ctx context.Context, target domainext.Target, fieldCode string) error
- func (r *ExtensionValueRepo) ListByTarget(ctx context.Context, target domainext.Target) ([]domainext.Value, error)
- func (r *ExtensionValueRepo) ListByTargets(ctx context.Context, targetType domainext.TargetType, targetIDs []string) ([]domainext.Value, error)
- func (r *ExtensionValueRepo) Upsert(ctx context.Context, value domainext.Value) error
- func (r *ExtensionValueRepo) UpsertBatch(ctx context.Context, values []domainext.Value) error
- type IntegrationIdempotencyRepo
- func (r *IntegrationIdempotencyRepo) Begin(ctx context.Context, plugin, key, method, path, requestHash string, ...) (*integrationhttp.IdempotencyRecord, bool, error)
- func (r *IntegrationIdempotencyRepo) Complete(ctx context.Context, plugin, key string, statusCode int, body []byte) error
- func (r *IntegrationIdempotencyRepo) Get(ctx context.Context, pluginSlug, key string) (*domainintegration.IdempotencyAdminRecord, error)
- func (r *IntegrationIdempotencyRepo) List(ctx context.Context, filter domainintegration.IdempotencyListFilter) ([]domainintegration.IdempotencyAdminRecord, error)
- type InvoiceRepo
- type JobQueue
- type MFARepo
- func (r *MFARepo) ClearEnrollment(ctx context.Context, customerID string) error
- func (r *MFARepo) ConsumeRecoveryCode(ctx context.Context, customerID, codeHash string) (bool, error)
- func (r *MFARepo) FinalizeEnrollment(ctx context.Context, customerID string, confirmedAt time.Time, ...) error
- func (r *MFARepo) GetState(ctx context.Context, customerID string) (domainMFA.State, error)
- func (r *MFARepo) ReplaceRecoveryCodes(ctx context.Context, customerID string, codeHashes []string) error
- func (r *MFARepo) SavePendingSecret(ctx context.Context, customerID, secretEnc string) error
- type MenuRepo
- func (r *MenuRepo) FindByCode(ctx context.Context, code string) (*cms.MenuWithItems, error)
- func (r *MenuRepo) FindByID(ctx context.Context, id string) (*cms.MenuWithItems, error)
- func (r *MenuRepo) List(ctx context.Context) ([]*cms.Menu, error)
- func (r *MenuRepo) Save(ctx context.Context, data *cms.MenuWithItems) error
- type OrderRepo
- func (r *OrderRepo) FindByContactEmail(ctx context.Context, contactEmail string) ([]order.Order, error)
- func (r *OrderRepo) FindByCustomerID(ctx context.Context, customerID string) ([]order.Order, error)
- func (r *OrderRepo) FindByID(ctx context.Context, id string) (*order.Order, error)
- func (r *OrderRepo) LinkToCustomer(ctx context.Context, o *order.Order) error
- func (r *OrderRepo) LinkToCustomerByContactEmail(ctx context.Context, contactEmail, customerID string, updatedAt time.Time) (int64, error)
- func (r *OrderRepo) List(ctx context.Context, offset, limit int) ([]order.Order, error)
- func (r *OrderRepo) ListPaidTaxSnapshots(ctx context.Context, from, to time.Time) ([]order.TaxSnapshotRow, error)
- func (r *OrderRepo) Save(ctx context.Context, o *order.Order) error
- func (r *OrderRepo) UpdateStatus(ctx context.Context, o *order.Order) error
- type PageRepo
- func (r *PageRepo) Create(ctx context.Context, p *cms.Page) error
- func (r *PageRepo) Delete(ctx context.Context, id string) error
- func (r *PageRepo) FindActiveBySlug(ctx context.Context, slug string) (*cms.Page, error)
- func (r *PageRepo) FindByID(ctx context.Context, id string) (*cms.Page, error)
- func (r *PageRepo) FindBySlug(ctx context.Context, slug string) (*cms.Page, error)
- func (r *PageRepo) List(ctx context.Context, offset, limit int) ([]*cms.Page, error)
- func (r *PageRepo) Update(ctx context.Context, p *cms.Page) error
- type PaymentRepo
- func (r *PaymentRepo) Create(ctx context.Context, p *payment.Payment) error
- func (r *PaymentRepo) FindByID(ctx context.Context, id string) (*payment.Payment, error)
- func (r *PaymentRepo) FindByOrderID(ctx context.Context, orderID string) (*payment.Payment, error)
- func (r *PaymentRepo) List(ctx context.Context, filter payment.ListFilter) ([]payment.Payment, error)
- func (r *PaymentRepo) UpdateStatus(ctx context.Context, p *payment.Payment, prevUpdatedAt time.Time) error
- type PriceHistoryRepo
- func (r *PriceHistoryRepo) LowestSince(ctx context.Context, variantID, currency, storeID string, since time.Time) (*pricing.PriceSnapshot, error)
- func (r *PriceHistoryRepo) LowestSinceByVariants(ctx context.Context, variantIDs []string, currency, storeID string, ...) (map[string]*pricing.PriceSnapshot, error)
- func (r *PriceHistoryRepo) Record(ctx context.Context, s *pricing.PriceSnapshot) error
- func (r *PriceHistoryRepo) WithTx(tx *sql.Tx) pricing.PriceHistoryRepository
- type PriceRepo
- func (r *PriceRepo) FindByVariantCurrencyAndStore(ctx context.Context, variantID, currency, storeID string) (*pricing.Price, error)
- func (r *PriceRepo) FindByVariantsCurrencyAndStore(ctx context.Context, variantIDs []string, currency, storeID string) (map[string]*pricing.Price, error)
- func (r *PriceRepo) List(ctx context.Context, offset, limit int) ([]pricing.Price, error)
- func (r *PriceRepo) ListByVariantID(ctx context.Context, variantID string) ([]pricing.Price, error)
- func (r *PriceRepo) Upsert(ctx context.Context, p *pricing.Price) error
- func (r *PriceRepo) WithTx(tx *sql.Tx) pricing.PriceRepository
- type ProductRepo
- func (r *ProductRepo) AssignCategory(ctx context.Context, productID, categoryID string) error
- func (r *ProductRepo) Create(ctx context.Context, p *catalog.Product) error
- func (r *ProductRepo) FindByCategoryID(ctx context.Context, categoryID string, offset, limit int) ([]catalog.Product, error)
- func (r *ProductRepo) FindByID(ctx context.Context, id string) (*catalog.Product, error)
- func (r *ProductRepo) FindBySlug(ctx context.Context, slug string) (*catalog.Product, error)
- func (r *ProductRepo) List(ctx context.Context, offset, limit int) ([]catalog.Product, error)
- func (r *ProductRepo) ListCategoryIDsByProduct(ctx context.Context, productID string) ([]string, error)
- func (r *ProductRepo) RemoveCategory(ctx context.Context, productID, categoryID string) error
- func (r *ProductRepo) Update(ctx context.Context, p *catalog.Product) error
- func (r *ProductRepo) WithTx(tx *sql.Tx) catalog.ProductRepository
- type PromotionRepo
- func (r *PromotionRepo) Delete(ctx context.Context, id string) error
- func (r *PromotionRepo) FindByID(ctx context.Context, id string) (*promotion.Promotion, error)
- func (r *PromotionRepo) List(ctx context.Context, offset, limit int) ([]promotion.Promotion, error)
- func (r *PromotionRepo) ListActive(ctx context.Context, typ promotion.PromotionType) ([]promotion.Promotion, error)
- func (r *PromotionRepo) Save(ctx context.Context, p *promotion.Promotion) error
- func (r *PromotionRepo) WithTx(tx *sql.Tx) *PromotionRepo
- type ReservationRepo
- func (r *ReservationRepo) Confirm(ctx context.Context, reservationID string) error
- func (r *ReservationRepo) FindByID(ctx context.Context, id string) (*inventory.Reservation, error)
- func (r *ReservationRepo) ListActiveByVariantID(ctx context.Context, variantID string) ([]inventory.Reservation, error)
- func (r *ReservationRepo) Release(ctx context.Context, reservationID string) error
- func (r *ReservationRepo) ReleaseExpiredBefore(ctx context.Context, cutoff time.Time) (int, error)
- func (r *ReservationRepo) Reserve(ctx context.Context, res *inventory.Reservation) error
- type ResetTokenRepo
- func (r *ResetTokenRepo) Create(ctx context.Context, t *customer.PasswordResetToken) error
- func (r *ResetTokenRepo) FindByTokenHash(ctx context.Context, hash string) (*customer.PasswordResetToken, error)
- func (r *ResetTokenRepo) MarkUsed(ctx context.Context, id string) error
- func (r *ResetTokenRepo) WithTx(tx *sql.Tx) *ResetTokenRepo
- type ReturnRepo
- func (r *ReturnRepo) FindByCustomerID(ctx context.Context, customerID string) ([]domainReturns.Return, error)
- func (r *ReturnRepo) FindByID(ctx context.Context, id string) (*domainReturns.Return, error)
- func (r *ReturnRepo) FindByOrderID(ctx context.Context, orderID string) ([]domainReturns.Return, error)
- func (r *ReturnRepo) List(ctx context.Context, offset, limit int) ([]domainReturns.Return, error)
- func (r *ReturnRepo) Save(ctx context.Context, ret *domainReturns.Return) error
- func (r *ReturnRepo) Update(ctx context.Context, ret *domainReturns.Return) error
- type ReviewRepo
- func (r *ReviewRepo) FindByID(ctx context.Context, id string) (*domainReview.Review, error)
- func (r *ReviewRepo) FindByProductAndCustomer(ctx context.Context, productID, customerID string) (*domainReview.Review, error)
- func (r *ReviewRepo) List(ctx context.Context, status domainReview.Status, offset, limit int) ([]domainReview.Review, error)
- func (r *ReviewRepo) ListApprovedByProduct(ctx context.Context, productID string, offset, limit int) ([]domainReview.Review, error)
- func (r *ReviewRepo) Save(ctx context.Context, rev *domainReview.Review) error
- func (r *ReviewRepo) SummaryByProduct(ctx context.Context, productID string) (domainReview.ProductSummary, error)
- func (r *ReviewRepo) Update(ctx context.Context, rev *domainReview.Review, priorStatus domainReview.Status) error
- type RewriteRepo
- type RolePermissionRepo
- func (r *RolePermissionRepo) EnsurePermissions(ctx context.Context, role identity.Role, perms []rbac.Permission) error
- func (r *RolePermissionRepo) ListAll(ctx context.Context) (map[identity.Role][]rbac.Permission, error)
- func (r *RolePermissionRepo) ReplaceForRole(ctx context.Context, role identity.Role, perms []rbac.Permission) error
- type SearchEngine
- func (e *SearchEngine) IndexProduct(ctx context.Context, p search.Product) error
- func (e *SearchEngine) Name() string
- func (e *SearchEngine) RemoveProduct(ctx context.Context, productID string) error
- func (e *SearchEngine) Search(ctx context.Context, query search.SearchQuery) (search.SearchResult, error)
- func (e *SearchEngine) Suggest(ctx context.Context, prefix string, limit int) ([]search.Suggestion, error)
- type ShippingRepo
- func (r *ShippingRepo) Create(ctx context.Context, s *shipping.Shipment) error
- func (r *ShippingRepo) FindByID(ctx context.Context, id string) (*shipping.Shipment, error)
- func (r *ShippingRepo) FindByOrderID(ctx context.Context, orderID string) (*shipping.Shipment, error)
- func (r *ShippingRepo) UpdateStatus(ctx context.Context, s *shipping.Shipment, prevUpdatedAt time.Time) error
- type StatsRepo
- type StockRepo
- func (r *StockRepo) GetInventoryItem(ctx context.Context, variantID string) (inventory.InventoryListItem, error)
- func (r *StockRepo) GetStock(ctx context.Context, variantID string) (inventory.StockEntry, error)
- func (r *StockRepo) ListInventory(ctx context.Context, offset, limit int, search string) ([]inventory.InventoryListItem, error)
- func (r *StockRepo) ListStock(ctx context.Context, offset, limit int) ([]inventory.StockEntry, error)
- func (r *StockRepo) SetStock(ctx context.Context, entry *inventory.StockEntry) error
- func (r *StockRepo) SetStocks(ctx context.Context, entries []inventory.StockEntry) error
- type StoreCreditRepo
- func (r *StoreCreditRepo) GetBalance(ctx context.Context, customerID, currency string) (shared.Money, error)
- func (r *StoreCreditRepo) Issue(ctx context.Context, customerID string, amount shared.Money, note string) error
- func (r *StoreCreditRepo) ListLedger(ctx context.Context, customerID, currency string, offset, limit int) ([]storecredit.Entry, error)
- func (r *StoreCreditRepo) Redeem(ctx context.Context, customerID, orderID string, amount shared.Money) error
- type StoreRepo
- func (r *StoreRepo) Create(ctx context.Context, s *store.Store) error
- func (r *StoreRepo) FindAll(ctx context.Context) ([]store.Store, error)
- func (r *StoreRepo) FindByCode(ctx context.Context, code string) (*store.Store, error)
- func (r *StoreRepo) FindByDomain(ctx context.Context, domain string) (*store.Store, error)
- func (r *StoreRepo) FindByID(ctx context.Context, id string) (*store.Store, error)
- func (r *StoreRepo) FindDefault(ctx context.Context) (*store.Store, error)
- func (r *StoreRepo) Update(ctx context.Context, s *store.Store) error
- type TaxRateRepo
- func (r *TaxRateRepo) CreateIfNotExists(ctx context.Context, tr *tax.TaxRate) (bool, error)
- func (r *TaxRateRepo) Delete(ctx context.Context, id string) error
- func (r *TaxRateRepo) FindByCountryClassAndStore(ctx context.Context, country, class, storeID string) (*tax.TaxRate, error)
- func (r *TaxRateRepo) ListByCountry(ctx context.Context, country string) ([]tax.TaxRate, error)
- func (r *TaxRateRepo) Upsert(ctx context.Context, tr *tax.TaxRate) error
- func (r *TaxRateRepo) WithTx(tx *sql.Tx) *TaxRateRepo
- type TranslationRepo
- func (r *TranslationRepo) Delete(ctx context.Context, key, language string) error
- func (r *TranslationRepo) FindByKeyAndLanguage(ctx context.Context, key, language string) (*translation.Translation, error)
- func (r *TranslationRepo) ListByLanguage(ctx context.Context, language string) ([]translation.Translation, error)
- func (r *TranslationRepo) Upsert(ctx context.Context, t *translation.Translation) error
- type VariantRepo
- func (r *VariantRepo) Create(ctx context.Context, v *catalog.Variant) error
- func (r *VariantRepo) FindByID(ctx context.Context, id string) (*catalog.Variant, error)
- func (r *VariantRepo) FindBySKU(ctx context.Context, sku string) (*catalog.Variant, error)
- func (r *VariantRepo) FindBySKUs(ctx context.Context, skus []string) (map[string]*catalog.Variant, error)
- func (r *VariantRepo) ListByProductID(ctx context.Context, productID string, offset, limit int) ([]catalog.Variant, error)
- func (r *VariantRepo) ListByProductIDs(ctx context.Context, productIDs []string, limitPerProduct int) (map[string][]catalog.Variant, error)
- func (r *VariantRepo) Update(ctx context.Context, v *catalog.Variant) error
- func (r *VariantRepo) WithTx(tx *sql.Tx) catalog.VariantRepository
- type WebhookEndpointRepo
- func (r *WebhookEndpointRepo) Create(ctx context.Context, endpoint *domainwebhook.Endpoint) error
- func (r *WebhookEndpointRepo) Delete(ctx context.Context, endpointID string) error
- func (r *WebhookEndpointRepo) FindByID(ctx context.Context, endpointID string) (*domainwebhook.Endpoint, error)
- func (r *WebhookEndpointRepo) List(ctx context.Context) ([]domainwebhook.Endpoint, error)
- func (r *WebhookEndpointRepo) ListActive(ctx context.Context) ([]domainwebhook.Endpoint, error)
- func (r *WebhookEndpointRepo) Update(ctx context.Context, endpoint *domainwebhook.Endpoint) error
- type ZoneRepo
- func (r *ZoneRepo) CreateRateTier(ctx context.Context, rt *shipping.RateTier) error
- func (r *ZoneRepo) CreateZone(ctx context.Context, z *shipping.Zone) error
- func (r *ZoneRepo) DeleteRateTier(ctx context.Context, id string) error
- func (r *ZoneRepo) DeleteZone(ctx context.Context, id string) error
- func (r *ZoneRepo) FindRateTierByID(ctx context.Context, id string) (*shipping.RateTier, error)
- func (r *ZoneRepo) FindZoneByID(ctx context.Context, id string) (*shipping.Zone, error)
- func (r *ZoneRepo) ListRateTiers(ctx context.Context, zoneID string) ([]shipping.RateTier, error)
- func (r *ZoneRepo) ListZones(ctx context.Context) ([]shipping.Zone, error)
- func (r *ZoneRepo) UpdateRateTier(ctx context.Context, rt *shipping.RateTier) error
- func (r *ZoneRepo) UpdateZone(ctx context.Context, z *shipping.Zone) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetRepo ¶
type AssetRepo struct {
// contains filtered or unexported fields
}
AssetRepo implements media.AssetRepository using PostgreSQL.
func NewAssetRepo ¶
NewAssetRepo returns a new AssetRepo backed by db.
func (*AssetRepo) FindByID ¶
FindByID returns an asset by its ID. Returns (nil, nil) when the asset does not exist.
type AuditLogRepo ¶
type AuditLogRepo struct {
// contains filtered or unexported fields
}
AuditLogRepo implements domainadmin.AuditLogRepository.
func NewAuditLogRepo ¶
func NewAuditLogRepo(db *sql.DB) (*AuditLogRepo, error)
NewAuditLogRepo returns an AuditLogRepo backed by db.
func (*AuditLogRepo) DeleteBefore ¶
func (*AuditLogRepo) Insert ¶
func (r *AuditLogRepo) Insert(ctx context.Context, record domainadmin.AuditLogRecord) error
func (*AuditLogRepo) List ¶
func (r *AuditLogRepo) List(ctx context.Context, filter domainadmin.AuditLogFilter) ([]domainadmin.AuditLogRecord, error)
type CacheStore ¶
type CacheStore struct {
// contains filtered or unexported fields
}
CacheStore implements cache.Cache using a PostgreSQL UNLOGGED table.
func NewCacheStore ¶
func NewCacheStore(db *sql.DB) (*CacheStore, error)
NewCacheStore returns a CacheStore backed by db.
func (*CacheStore) CompareAndSubtract ¶
func (s *CacheStore) CompareAndSubtract(key string, expected int64) (int64, error)
CompareAndSubtract subtracts expected from the counter when current >= expected. Uses a single transaction with SELECT … FOR UPDATE on key so the locked row is the one deleted/updated (no ctid matching). When current < expected, returns the unchanged current count.
func (*CacheStore) Delete ¶
func (s *CacheStore) Delete(key string) error
Delete removes the entry for key. A missing key is not an error.
func (*CacheStore) DeleteByPrefix ¶
func (s *CacheStore) DeleteByPrefix(ctx context.Context, prefix string) error
DeleteByPrefix removes all entries whose key starts with prefix. LIKE metacharacters (%, _, \) in prefix are escaped so only true prefix matches are deleted.
func (*CacheStore) DeleteExpired ¶
func (s *CacheStore) DeleteExpired(ctx context.Context) (int64, error)
DeleteExpired removes all entries whose TTL has elapsed. Called by the cache cleanup scheduled job.
func (*CacheStore) Get ¶
func (s *CacheStore) Get(key string, dest any) (bool, error)
Get retrieves the cached value for key and unmarshals it into dest. Returns (true, nil) on hit, (false, nil) on miss.
type CartRepo ¶
type CartRepo struct {
// contains filtered or unexported fields
}
CartRepo implements cart.CartRepository using PostgreSQL.
func NewCartRepo ¶
NewCartRepo returns a new CartRepo backed by db.
func (*CartRepo) FindActiveByCustomerID ¶
func (r *CartRepo) FindActiveByCustomerID(ctx context.Context, customerID string) (*cart.Cart, error)
FindActiveByCustomerID returns the active cart for a customer. Returns (nil, nil) when not found. Uses a REPEATABLE READ read-only transaction for a consistent snapshot.
func (*CartRepo) FindByID ¶
FindByID returns a cart with its items by ID. Returns (nil, nil) when not found. Uses a REPEATABLE READ read-only transaction for a consistent snapshot.
func (*CartRepo) FindRecoveryCandidates ¶
func (r *CartRepo) FindRecoveryCandidates(ctx context.Context, staleBefore time.Time, limit int) ([]*cart.Cart, error)
FindRecoveryCandidates returns active customer carts with items that are stale and unemailed.
func (*CartRepo) MarkRecoveryEmailSent ¶
func (r *CartRepo) MarkRecoveryEmailSent(ctx context.Context, cartID string, sentAt time.Time) (bool, error)
MarkRecoveryEmailSent records a recovery email send when not already recorded.
func (*CartRepo) Save ¶
Save persists a cart and its items (upsert). Uses a transaction to ensure the cart header and items are written atomically. Optimistic locking: on update the version must match the value loaded by FindByID. If another writer incremented it first, Save returns a conflict error.
type CategoryRepo ¶
type CategoryRepo struct {
// contains filtered or unexported fields
}
CategoryRepo implements catalog.CategoryRepository using PostgreSQL.
func NewCategoryRepo ¶
func NewCategoryRepo(db *sql.DB) (*CategoryRepo, error)
NewCategoryRepo returns a new CategoryRepo backed by db.
func (*CategoryRepo) Delete ¶
func (r *CategoryRepo) Delete(ctx context.Context, id string) error
Delete removes a category by ID.
func (*CategoryRepo) FindAll ¶
FindAll returns all categories ordered by position asc, then name asc.
func (*CategoryRepo) FindByID ¶
FindByID returns a category by its ID. Returns (nil, nil) when not found.
func (*CategoryRepo) FindByParentID ¶
func (r *CategoryRepo) FindByParentID(ctx context.Context, parentID *string) ([]catalog.Category, error)
FindByParentID returns child categories of the given parent, ordered by position asc, then name asc. Pass nil parentID to get root categories.
func (*CategoryRepo) FindBySlug ¶
FindBySlug returns a category by its slug. Returns (nil, nil) when not found.
type CollectionRepo ¶
type CollectionRepo struct {
// contains filtered or unexported fields
}
CollectionRepo implements catalog.CollectionRepository using PostgreSQL.
func NewCollectionRepo ¶
func NewCollectionRepo(db *sql.DB) (*CollectionRepo, error)
NewCollectionRepo returns a new CollectionRepo backed by db.
func (*CollectionRepo) AddProduct ¶
func (r *CollectionRepo) AddProduct(ctx context.Context, collectionID, productID string) error
AddProduct assigns a product to a manual collection.
func (*CollectionRepo) Create ¶
func (r *CollectionRepo) Create(ctx context.Context, c *catalog.Collection) error
Create persists a new collection.
func (*CollectionRepo) FindByID ¶
func (r *CollectionRepo) FindByID(ctx context.Context, id string) (*catalog.Collection, error)
FindByID returns a collection by its ID. Returns (nil, nil) when not found.
func (*CollectionRepo) FindBySlug ¶
func (r *CollectionRepo) FindBySlug(ctx context.Context, slug string) (*catalog.Collection, error)
FindBySlug returns a collection by its slug. Returns (nil, nil) when not found.
func (*CollectionRepo) List ¶
func (r *CollectionRepo) List(ctx context.Context) ([]catalog.Collection, error)
List returns all collections ordered by name asc.
func (*CollectionRepo) ListProductIDs ¶
ListProductIDs returns the product IDs assigned to a manual collection, ordered by product_id asc.
func (*CollectionRepo) RemoveProduct ¶
func (r *CollectionRepo) RemoveProduct(ctx context.Context, collectionID, productID string) error
RemoveProduct removes a product from a manual collection.
func (*CollectionRepo) Update ¶
func (r *CollectionRepo) Update(ctx context.Context, c *catalog.Collection) error
Update persists changes to an existing collection.
type ConfigRepo ¶
type ConfigRepo struct {
// contains filtered or unexported fields
}
ConfigRepo implements config.Repository using PostgreSQL.
func NewConfigRepo ¶
func NewConfigRepo(db configDB) *ConfigRepo
NewConfigRepo returns a ConfigRepo backed by db. db may be a *sql.DB or *sql.Tx; pass a Tx to run operations inside an existing transaction (e.g. bulk import).
func (*ConfigRepo) Delete ¶
func (r *ConfigRepo) Delete(ctx context.Context, key string) error
Delete removes the entry for key. A missing key is not an error.
func (*ConfigRepo) Get ¶
func (r *ConfigRepo) Get(ctx context.Context, key string) (interface{}, error)
Get retrieves the value for key. Returns (nil, nil) on miss.
type ConsentRepo ¶
type ConsentRepo struct {
// contains filtered or unexported fields
}
ConsentRepo implements legal.ConsentRepository using PostgreSQL.
func NewConsentRepo ¶
func NewConsentRepo(db *sql.DB) (*ConsentRepo, error)
NewConsentRepo returns a new ConsentRepo backed by db.
func (*ConsentRepo) DeleteByCustomerID ¶
func (r *ConsentRepo) DeleteByCustomerID(ctx context.Context, customerID string) error
DeleteByCustomerID removes the consent record for a customer.
func (*ConsentRepo) FindByCustomerID ¶
func (r *ConsentRepo) FindByCustomerID(ctx context.Context, customerID string) (*legal.Consent, error)
FindByCustomerID returns the consent for a customer. Returns (nil, nil) when not found.
func (*ConsentRepo) WithTx ¶
func (r *ConsentRepo) WithTx(tx *sql.Tx) legal.ConsentRepository
WithTx returns a repo bound to the given transaction.
type ContentBlockRepo ¶
type ContentBlockRepo struct {
// contains filtered or unexported fields
}
ContentBlockRepo implements cms.ContentBlockRepository using PostgreSQL.
func NewContentBlockRepo ¶
func NewContentBlockRepo(db *sql.DB) (*ContentBlockRepo, error)
NewContentBlockRepo returns a new ContentBlockRepo backed by db.
func (*ContentBlockRepo) Create ¶
func (r *ContentBlockRepo) Create(ctx context.Context, block *cms.ContentBlock) error
Create persists a new content block.
func (*ContentBlockRepo) Delete ¶
func (r *ContentBlockRepo) Delete(ctx context.Context, blockID string) error
Delete removes a content block by ID.
func (*ContentBlockRepo) FindActiveBlocksByTarget ¶
func (r *ContentBlockRepo) FindActiveBlocksByTarget(ctx context.Context, targetType cms.TargetType, targetKey string) ([]*cms.ContentBlock, error)
FindActiveBlocksByTarget returns active placed blocks for storefront and public APIs.
func (*ContentBlockRepo) FindBlocksByTarget ¶
func (r *ContentBlockRepo) FindBlocksByTarget(ctx context.Context, targetType cms.TargetType, targetKey string) ([]*cms.ContentBlock, error)
FindBlocksByTarget returns placed blocks for admin views, including inactive blocks.
func (*ContentBlockRepo) FindByID ¶
func (r *ContentBlockRepo) FindByID(ctx context.Context, blockID string) (*cms.ContentBlock, error)
FindByID returns a block by ID.
func (*ContentBlockRepo) List ¶
func (r *ContentBlockRepo) List(ctx context.Context, offset, limit int) ([]*cms.ContentBlock, error)
List returns content blocks ordered by title.
func (*ContentBlockRepo) SaveTargetPlacements ¶
func (r *ContentBlockRepo) SaveTargetPlacements(ctx context.Context, targetType cms.TargetType, targetKey string, blockIDs []string) error
SaveTargetPlacements replaces all placements for a target with the given block IDs.
func (*ContentBlockRepo) Update ¶
func (r *ContentBlockRepo) Update(ctx context.Context, block *cms.ContentBlock) error
Update persists changes to an existing content block.
type ContentTranslationRepo ¶
type ContentTranslationRepo struct {
// contains filtered or unexported fields
}
ContentTranslationRepo implements translation.ContentTranslationRepository using PostgreSQL.
func NewContentTranslationRepo ¶
func NewContentTranslationRepo(db *sql.DB) (*ContentTranslationRepo, error)
NewContentTranslationRepo returns a new ContentTranslationRepo backed by db.
func (*ContentTranslationRepo) DeleteByEntity ¶
func (r *ContentTranslationRepo) DeleteByEntity(ctx context.Context, entityID string) error
DeleteByEntity removes all translations for an entity.
func (*ContentTranslationRepo) FindByEntityAndLanguage ¶
func (r *ContentTranslationRepo) FindByEntityAndLanguage(ctx context.Context, entityID, language string) ([]translation.ContentTranslation, error)
FindByEntityAndLanguage returns all translated fields for an entity in a language. Returns an empty slice (not nil) when no translations exist.
func (*ContentTranslationRepo) FindFieldValue ¶
func (r *ContentTranslationRepo) FindFieldValue(ctx context.Context, entityID, language, field string) (*translation.ContentTranslation, error)
FindFieldValue returns the translated value for a specific entity+language+field. Returns (nil, nil) when not found.
func (*ContentTranslationRepo) Upsert ¶
func (r *ContentTranslationRepo) Upsert(ctx context.Context, ct *translation.ContentTranslation) error
Upsert creates or updates a content translation for an entity+language+field tuple.
type CouponRepo ¶
type CouponRepo struct {
// contains filtered or unexported fields
}
CouponRepo implements promotion.CouponRepository using PostgreSQL.
func NewCouponRepo ¶
func NewCouponRepo(db *sql.DB) (*CouponRepo, error)
NewCouponRepo returns a new CouponRepo backed by db.
func (*CouponRepo) FindByCode ¶
func (*CouponRepo) ListByPromotion ¶
func (*CouponRepo) WithTx ¶
func (r *CouponRepo) WithTx(tx *sql.Tx) *CouponRepo
WithTx returns a repo bound to the given transaction.
type CreditNoteRepo ¶
type CreditNoteRepo struct {
// contains filtered or unexported fields
}
CreditNoteRepo implements invoice.CreditNoteRepository using PostgreSQL.
func NewCreditNoteRepo ¶
func NewCreditNoteRepo(db *sql.DB) (*CreditNoteRepo, error)
NewCreditNoteRepo returns a new CreditNoteRepo backed by db.
func (*CreditNoteRepo) FindByID ¶
func (r *CreditNoteRepo) FindByID(ctx context.Context, id string) (*invoice.CreditNote, error)
FindByID returns a credit note with its items by ID. Returns (nil, nil) when not found.
func (*CreditNoteRepo) FindByInvoiceID ¶
func (r *CreditNoteRepo) FindByInvoiceID(ctx context.Context, invoiceID string) ([]invoice.CreditNote, error)
FindByInvoiceID returns all credit notes for an invoice, newest first.
func (*CreditNoteRepo) Save ¶
func (r *CreditNoteRepo) Save(ctx context.Context, cn *invoice.CreditNote) error
Save persists a credit note and its items (insert-only). Assigns CreditNoteNumber from the DB sequence.
type CustomerAddressRepo ¶
type CustomerAddressRepo struct {
// contains filtered or unexported fields
}
CustomerAddressRepo implements customer.AddressRepository using PostgreSQL.
func NewCustomerAddressRepo ¶
func NewCustomerAddressRepo(db *sql.DB) (*CustomerAddressRepo, error)
NewCustomerAddressRepo returns a new CustomerAddressRepo backed by db.
func (*CustomerAddressRepo) Create ¶
Create persists a new address. The first address a customer saves, or any address created with IsDefault set, becomes their default.
func (*CustomerAddressRepo) Delete ¶
func (r *CustomerAddressRepo) Delete(ctx context.Context, customerID, addressID string) error
Delete removes an address owned by the customer.
func (*CustomerAddressRepo) FindByID ¶
FindByID returns an address by its ID. Returns (nil, nil) when not found.
func (*CustomerAddressRepo) FindDefault ¶
func (r *CustomerAddressRepo) FindDefault(ctx context.Context, customerID string) (*customer.Address, error)
FindDefault returns the customer's default address, or (nil, nil) when none.
func (*CustomerAddressRepo) ListByCustomer ¶
func (r *CustomerAddressRepo) ListByCustomer(ctx context.Context, customerID string) ([]customer.Address, error)
ListByCustomer returns the customer's saved addresses, default first.
func (*CustomerAddressRepo) SetDefault ¶
func (r *CustomerAddressRepo) SetDefault(ctx context.Context, customerID, addressID string) error
SetDefault marks one address as the customer's default and clears the rest.
type CustomerRepo ¶
type CustomerRepo struct {
// contains filtered or unexported fields
}
CustomerRepo implements customer.CustomerRepository using PostgreSQL.
func NewCustomerRepo ¶
func NewCustomerRepo(db *sql.DB) (*CustomerRepo, error)
NewCustomerRepo returns a new CustomerRepo backed by db.
func (*CustomerRepo) BumpTokenGeneration ¶
func (r *CustomerRepo) BumpTokenGeneration(ctx context.Context, customerID string) error
BumpTokenGeneration atomically increments the customer's token generation.
func (*CustomerRepo) ChangePasswordAndBumpTokenGeneration ¶
func (r *CustomerRepo) ChangePasswordAndBumpTokenGeneration(ctx context.Context, customerID, passwordHash string) error
ChangePasswordAndBumpTokenGeneration atomically updates the password hash and invalidates previously issued tokens.
func (*CustomerRepo) Delete ¶
func (r *CustomerRepo) Delete(ctx context.Context, id string) error
Delete removes a customer by ID.
func (*CustomerRepo) FindByEmail ¶
FindByEmail returns a customer by email address (case-insensitive). Returns (nil, nil) when not found.
func (*CustomerRepo) FindByID ¶
FindByID returns a customer by its ID. Returns (nil, nil) when not found.
func (*CustomerRepo) HasActiveAdmin ¶
func (r *CustomerRepo) HasActiveAdmin(ctx context.Context) (bool, error)
HasActiveAdmin reports whether at least one active admin user exists.
func (*CustomerRepo) ListAdminUsers ¶
func (r *CustomerRepo) ListAdminUsers(ctx context.Context, offset, limit int) ([]customer.Customer, error)
ListAdminUsers returns admin-capable users ordered by email.
func (*CustomerRepo) ListCustomers ¶
func (r *CustomerRepo) ListCustomers(ctx context.Context, offset, limit int) ([]customer.Customer, error)
ListCustomers returns a paginated slice of customers ordered by email.
func (*CustomerRepo) UpdateAdminUser ¶
func (r *CustomerRepo) UpdateAdminUser(ctx context.Context, c *customer.Customer, priorRole customer.Role, priorStatus customer.Status, revokeSessions bool) error
UpdateAdminUser atomically updates an admin user and enforces last-active-admin rules.
func (*CustomerRepo) WithTx ¶
func (r *CustomerRepo) WithTx(tx *sql.Tx) customer.CustomerRepository
WithTx returns a repo bound to the given transaction.
type ExtensionFieldRepo ¶
type ExtensionFieldRepo struct {
// contains filtered or unexported fields
}
ExtensionFieldRepo persists extension field definitions in Postgres.
func NewExtensionFieldRepo ¶
func NewExtensionFieldRepo(db *sql.DB) (*ExtensionFieldRepo, error)
NewExtensionFieldRepo creates an ExtensionFieldRepo.
func (*ExtensionFieldRepo) Create ¶
func (r *ExtensionFieldRepo) Create(ctx context.Context, field domainext.ExtensionField) error
Create inserts a new active field or restores a soft-deleted row.
func (*ExtensionFieldRepo) FindByCode ¶
func (r *ExtensionFieldRepo) FindByCode(ctx context.Context, code string) (domainext.ExtensionField, error)
FindByCode returns an active field by code.
func (*ExtensionFieldRepo) ListActive ¶
func (r *ExtensionFieldRepo) ListActive(ctx context.Context, scope domainext.TargetType) ([]domainext.ExtensionField, error)
ListActive returns non-deleted fields, optionally filtered by scope.
func (*ExtensionFieldRepo) Save ¶
func (r *ExtensionFieldRepo) Save(ctx context.Context, field domainext.ExtensionField) error
Save upserts an extension field definition.
func (*ExtensionFieldRepo) SoftDelete ¶
func (r *ExtensionFieldRepo) SoftDelete(ctx context.Context, code string) error
SoftDelete marks a field as deleted.
type ExtensionValueRepo ¶
type ExtensionValueRepo struct {
// contains filtered or unexported fields
}
ExtensionValueRepo persists extension field values in Postgres.
func NewExtensionValueRepo ¶
func NewExtensionValueRepo(db *sql.DB) (*ExtensionValueRepo, error)
NewExtensionValueRepo creates an ExtensionValueRepo.
func (*ExtensionValueRepo) Delete ¶
func (r *ExtensionValueRepo) Delete(ctx context.Context, target domainext.Target, fieldCode string) error
Delete removes a value row.
func (*ExtensionValueRepo) ListByTarget ¶
func (r *ExtensionValueRepo) ListByTarget(ctx context.Context, target domainext.Target) ([]domainext.Value, error)
ListByTarget returns all values for a target.
func (*ExtensionValueRepo) ListByTargets ¶
func (r *ExtensionValueRepo) ListByTargets(ctx context.Context, targetType domainext.TargetType, targetIDs []string) ([]domainext.Value, error)
ListByTargets returns all values for many targets of the same type.
func (*ExtensionValueRepo) UpsertBatch ¶
UpsertBatch stores or replaces value rows in a single transaction.
type IntegrationIdempotencyRepo ¶
type IntegrationIdempotencyRepo struct {
// contains filtered or unexported fields
}
IntegrationIdempotencyRepo persists inbound integration idempotency keys in Postgres.
func NewIntegrationIdempotencyRepo ¶
func NewIntegrationIdempotencyRepo(db *sql.DB) (*IntegrationIdempotencyRepo, error)
NewIntegrationIdempotencyRepo returns an IntegrationIdempotencyRepo backed by db.
func (*IntegrationIdempotencyRepo) Begin ¶
func (r *IntegrationIdempotencyRepo) Begin(ctx context.Context, plugin, key, method, path, requestHash string, expiresAt time.Time) (*integrationhttp.IdempotencyRecord, bool, error)
Begin claims or loads an idempotency key.
func (*IntegrationIdempotencyRepo) Complete ¶
func (r *IntegrationIdempotencyRepo) Complete(ctx context.Context, plugin, key string, statusCode int, body []byte) error
Complete stores the response for a claimed idempotency key.
func (*IntegrationIdempotencyRepo) Get ¶
func (r *IntegrationIdempotencyRepo) Get(ctx context.Context, pluginSlug, key string) (*domainintegration.IdempotencyAdminRecord, error)
Get returns one idempotency record by plugin slug and key (includes stored response body).
func (*IntegrationIdempotencyRepo) List ¶
func (r *IntegrationIdempotencyRepo) List(ctx context.Context, filter domainintegration.IdempotencyListFilter) ([]domainintegration.IdempotencyAdminRecord, error)
List returns idempotency records ordered by newest first (without response bodies).
type InvoiceRepo ¶
type InvoiceRepo struct {
// contains filtered or unexported fields
}
InvoiceRepo implements invoice.InvoiceRepository using PostgreSQL.
func NewInvoiceRepo ¶
func NewInvoiceRepo(db *sql.DB) (*InvoiceRepo, error)
NewInvoiceRepo returns a new InvoiceRepo backed by db.
func (*InvoiceRepo) FindByID ¶
FindByID returns an invoice with its items by ID. Returns (nil, nil) when not found.
func (*InvoiceRepo) FindByOrderID ¶
FindByOrderID returns the invoice for an order. Returns (nil, nil) when not found.
type JobQueue ¶
type JobQueue struct {
// contains filtered or unexported fields
}
JobQueue implements jobs.Queue using PostgreSQL with FOR UPDATE SKIP LOCKED.
func NewJobQueue ¶
NewJobQueue returns a new JobQueue backed by db.
func (*JobQueue) Dequeue ¶
Dequeue atomically claims the next pending job using FOR UPDATE SKIP LOCKED. Returns nil, nil when no jobs are available.
type MFARepo ¶
type MFARepo struct {
// contains filtered or unexported fields
}
MFARepo implements mfa.Repository using PostgreSQL.
func NewMFARepo ¶
NewMFARepo returns an MFARepo backed by db.
func (*MFARepo) ClearEnrollment ¶
ClearEnrollment removes MFA state for a customer.
func (*MFARepo) ConsumeRecoveryCode ¶
func (r *MFARepo) ConsumeRecoveryCode(ctx context.Context, customerID, codeHash string) (bool, error)
ConsumeRecoveryCode marks a matching unused recovery code as used.
func (*MFARepo) FinalizeEnrollment ¶
func (r *MFARepo) FinalizeEnrollment(ctx context.Context, customerID string, confirmedAt time.Time, codeHashes []string) error
ConfirmEnrollment marks TOTP as active and stores recovery codes atomically.
type MenuRepo ¶
type MenuRepo struct {
// contains filtered or unexported fields
}
MenuRepo implements cms.MenuRepository using PostgreSQL.
func NewMenuRepo ¶
NewMenuRepo returns a new MenuRepo backed by db.
func (*MenuRepo) FindByCode ¶
FindByCode returns a menu with items by code.
type OrderRepo ¶
type OrderRepo struct {
// contains filtered or unexported fields
}
OrderRepo implements order.OrderRepository using PostgreSQL.
func NewOrderRepo ¶
NewOrderRepo returns a new OrderRepo backed by db.
func (*OrderRepo) FindByContactEmail ¶
func (r *OrderRepo) FindByContactEmail(ctx context.Context, contactEmail string) ([]order.Order, error)
FindByContactEmail returns all orders with a matching contact email, newest first. Used for guest order discovery. Returns empty slice if none found.
func (*OrderRepo) FindByCustomerID ¶
FindByCustomerID returns all orders for a customer, newest first.
func (*OrderRepo) FindByID ¶
FindByID returns an order with its items by ID. Returns (nil, nil) when not found.
func (*OrderRepo) LinkToCustomer ¶
LinkToCustomer persists customer ownership for a previously guest order. The WHERE guard (customer_id = ”) ensures an already-linked order is never silently reassigned to another customer.
func (*OrderRepo) LinkToCustomerByContactEmail ¶
func (r *OrderRepo) LinkToCustomerByContactEmail(ctx context.Context, contactEmail, customerID string, updatedAt time.Time) (int64, error)
LinkToCustomerByContactEmail atomically links every unclaimed guest order carrying the contact email to the customer. A single UPDATE statement keeps the multi-order claim all-or-nothing.
func (*OrderRepo) ListPaidTaxSnapshots ¶
func (r *OrderRepo) ListPaidTaxSnapshots(ctx context.Context, from, to time.Time) ([]order.TaxSnapshotRow, error)
ListPaidTaxSnapshots returns paid orders with destination country in [from, to).
type PageRepo ¶
type PageRepo struct {
// contains filtered or unexported fields
}
PageRepo implements cms.PageRepository using PostgreSQL.
func NewPageRepo ¶
NewPageRepo returns a new PageRepo backed by db.
func (*PageRepo) FindActiveBySlug ¶
FindActiveBySlug returns an active page by its slug. Returns (nil, nil) when not found or inactive.
func (*PageRepo) FindBySlug ¶
FindBySlug returns a page by its slug regardless of active status. Returns (nil, nil) when not found.
type PaymentRepo ¶
type PaymentRepo struct {
// contains filtered or unexported fields
}
PaymentRepo implements payment.PaymentRepository using PostgreSQL.
func NewPaymentRepo ¶
func NewPaymentRepo(db *sql.DB) (*PaymentRepo, error)
NewPaymentRepo returns a new PaymentRepo backed by db.
func (*PaymentRepo) FindByID ¶
FindByID returns a payment by its ID. Returns (nil, nil) when not found.
func (*PaymentRepo) FindByOrderID ¶
FindByOrderID returns the payment for a given order. Returns (nil, nil) when no payment exists for the order.
func (*PaymentRepo) List ¶
func (r *PaymentRepo) List(ctx context.Context, filter payment.ListFilter) ([]payment.Payment, error)
List returns payments ordered by created_at desc with optional status filter.
func (*PaymentRepo) UpdateStatus ¶
func (r *PaymentRepo) UpdateStatus(ctx context.Context, p *payment.Payment, prevUpdatedAt time.Time) error
UpdateStatus updates the status, provider_ref, and updated_at of a payment. Uses optimistic locking via updated_at to detect concurrent modifications.
type PriceHistoryRepo ¶
type PriceHistoryRepo struct {
// contains filtered or unexported fields
}
PriceHistoryRepo implements pricing.PriceHistoryRepository using PostgreSQL.
func NewPriceHistoryRepo ¶
func NewPriceHistoryRepo(db *sql.DB) (*PriceHistoryRepo, error)
NewPriceHistoryRepo returns a new PriceHistoryRepo backed by db.
func (*PriceHistoryRepo) LowestSince ¶
func (r *PriceHistoryRepo) LowestSince(ctx context.Context, variantID, currency, storeID string, since time.Time) (*pricing.PriceSnapshot, error)
LowestSince returns the snapshot with the lowest amount for the given variant, currency, and store recorded on or after since. Returns (nil, nil) when no snapshots exist in the window.
func (*PriceHistoryRepo) LowestSinceByVariants ¶
func (r *PriceHistoryRepo) LowestSinceByVariants(ctx context.Context, variantIDs []string, currency, storeID string, since time.Time) (map[string]*pricing.PriceSnapshot, error)
LowestSinceByVariants returns the lowest snapshot per variant in the window.
func (*PriceHistoryRepo) Record ¶
func (r *PriceHistoryRepo) Record(ctx context.Context, s *pricing.PriceSnapshot) error
Record inserts a new price snapshot.
func (*PriceHistoryRepo) WithTx ¶
func (r *PriceHistoryRepo) WithTx(tx *sql.Tx) pricing.PriceHistoryRepository
WithTx returns a repo bound to the given transaction.
type PriceRepo ¶
type PriceRepo struct {
// contains filtered or unexported fields
}
PriceRepo implements pricing.PriceRepository using PostgreSQL.
func NewPriceRepo ¶
NewPriceRepo returns a new PriceRepo backed by db.
func (*PriceRepo) FindByVariantCurrencyAndStore ¶
func (r *PriceRepo) FindByVariantCurrencyAndStore(ctx context.Context, variantID, currency, storeID string) (*pricing.Price, error)
FindByVariantCurrencyAndStore returns the price for a variant in the given currency and store. An empty storeID means the global/default price. Returns (nil, nil) when no price exists.
func (*PriceRepo) FindByVariantsCurrencyAndStore ¶
func (r *PriceRepo) FindByVariantsCurrencyAndStore(ctx context.Context, variantIDs []string, currency, storeID string) (map[string]*pricing.Price, error)
FindByVariantsCurrencyAndStore returns prices for multiple variants.
func (*PriceRepo) ListByVariantID ¶
ListByVariantID returns all prices for a variant.
type ProductRepo ¶
type ProductRepo struct {
// contains filtered or unexported fields
}
ProductRepo implements catalog.ProductRepository using PostgreSQL.
func NewProductRepo ¶
func NewProductRepo(db *sql.DB) (*ProductRepo, error)
NewProductRepo returns a new ProductRepo backed by db.
func (*ProductRepo) AssignCategory ¶
func (r *ProductRepo) AssignCategory(ctx context.Context, productID, categoryID string) error
AssignCategory creates a product-category link when it does not already exist.
func (*ProductRepo) FindByCategoryID ¶
func (r *ProductRepo) FindByCategoryID(ctx context.Context, categoryID string, offset, limit int) ([]catalog.Product, error)
FindByCategoryID returns products belonging to the given category, ordered by created_at desc.
func (*ProductRepo) FindByID ¶
FindByID returns a product by its ID. Returns (nil, nil) when the product does not exist.
func (*ProductRepo) FindBySlug ¶
FindBySlug returns a product by its slug. Returns (nil, nil) when no product matches the slug.
func (*ProductRepo) ListCategoryIDsByProduct ¶
func (r *ProductRepo) ListCategoryIDsByProduct(ctx context.Context, productID string) ([]string, error)
ListCategoryIDsByProduct returns assigned category IDs for a product.
func (*ProductRepo) RemoveCategory ¶
func (r *ProductRepo) RemoveCategory(ctx context.Context, productID, categoryID string) error
RemoveCategory deletes a product-category link.
func (*ProductRepo) WithTx ¶
func (r *ProductRepo) WithTx(tx *sql.Tx) catalog.ProductRepository
WithTx returns a repo bound to the given transaction.
type PromotionRepo ¶
type PromotionRepo struct {
// contains filtered or unexported fields
}
PromotionRepo implements promotion.PromotionRepository using PostgreSQL.
func NewPromotionRepo ¶
func NewPromotionRepo(db *sql.DB) (*PromotionRepo, error)
NewPromotionRepo returns a new PromotionRepo backed by db.
func (*PromotionRepo) ListActive ¶
func (r *PromotionRepo) ListActive(ctx context.Context, typ promotion.PromotionType) ([]promotion.Promotion, error)
func (*PromotionRepo) WithTx ¶
func (r *PromotionRepo) WithTx(tx *sql.Tx) *PromotionRepo
WithTx returns a repo bound to the given transaction.
type ReservationRepo ¶
type ReservationRepo struct {
// contains filtered or unexported fields
}
ReservationRepo implements inventory.ReservationRepository using PostgreSQL.
func NewReservationRepo ¶
func NewReservationRepo(db *sql.DB) (*ReservationRepo, error)
NewReservationRepo returns a new ReservationRepo backed by db.
func (*ReservationRepo) Confirm ¶
func (r *ReservationRepo) Confirm(ctx context.Context, reservationID string) error
Confirm marks a reservation as confirmed without restoring stock.
func (*ReservationRepo) FindByID ¶
func (r *ReservationRepo) FindByID(ctx context.Context, id string) (*inventory.Reservation, error)
FindByID returns a reservation by its ID.
func (*ReservationRepo) ListActiveByVariantID ¶
func (r *ReservationRepo) ListActiveByVariantID(ctx context.Context, variantID string) ([]inventory.Reservation, error)
ListActiveByVariantID returns all active reservations for a variant.
func (*ReservationRepo) Release ¶
func (r *ReservationRepo) Release(ctx context.Context, reservationID string) error
Release cancels an active reservation and restores stock.
func (*ReservationRepo) ReleaseExpiredBefore ¶
ReleaseExpiredBefore atomically releases all active reservations that expired before cutoff and restores their quantities to stock.
func (*ReservationRepo) Reserve ¶
func (r *ReservationRepo) Reserve(ctx context.Context, res *inventory.Reservation) error
Reserve atomically decrements stock and creates a reservation within a transaction.
type ResetTokenRepo ¶
type ResetTokenRepo struct {
// contains filtered or unexported fields
}
ResetTokenRepo implements customer.PasswordResetRepository using PostgreSQL.
func NewResetTokenRepo ¶
func NewResetTokenRepo(db *sql.DB) (*ResetTokenRepo, error)
NewResetTokenRepo returns a new ResetTokenRepo backed by db.
func (*ResetTokenRepo) Create ¶
func (r *ResetTokenRepo) Create(ctx context.Context, t *customer.PasswordResetToken) error
Create persists a new password reset token.
func (*ResetTokenRepo) FindByTokenHash ¶
func (r *ResetTokenRepo) FindByTokenHash(ctx context.Context, hash string) (*customer.PasswordResetToken, error)
FindByTokenHash returns a reset token by its hash.
func (*ResetTokenRepo) MarkUsed ¶
func (r *ResetTokenRepo) MarkUsed(ctx context.Context, id string) error
MarkUsed sets the used_at timestamp on a reset token. Only updates if the token has not already been used (used_at IS NULL), preventing TOCTOU races between concurrent callers.
func (*ResetTokenRepo) WithTx ¶
func (r *ResetTokenRepo) WithTx(tx *sql.Tx) *ResetTokenRepo
WithTx returns a repo bound to the given transaction.
type ReturnRepo ¶
type ReturnRepo struct {
// contains filtered or unexported fields
}
ReturnRepo implements returns.Repository using PostgreSQL.
func NewReturnRepo ¶
func NewReturnRepo(db *sql.DB) (*ReturnRepo, error)
NewReturnRepo returns a new ReturnRepo backed by db.
func (*ReturnRepo) FindByCustomerID ¶
func (r *ReturnRepo) FindByCustomerID(ctx context.Context, customerID string) ([]domainReturns.Return, error)
FindByCustomerID returns all returns for a customer, newest first.
func (*ReturnRepo) FindByID ¶
func (r *ReturnRepo) FindByID(ctx context.Context, id string) (*domainReturns.Return, error)
FindByID returns a return with its items.
func (*ReturnRepo) FindByOrderID ¶
func (r *ReturnRepo) FindByOrderID(ctx context.Context, orderID string) ([]domainReturns.Return, error)
FindByOrderID returns all returns for an order, newest first.
func (*ReturnRepo) List ¶
func (r *ReturnRepo) List(ctx context.Context, offset, limit int) ([]domainReturns.Return, error)
List returns returns ordered by created_at desc with pagination.
func (*ReturnRepo) Save ¶
func (r *ReturnRepo) Save(ctx context.Context, ret *domainReturns.Return) error
Save inserts a new return and its items.
func (*ReturnRepo) Update ¶
func (r *ReturnRepo) Update(ctx context.Context, ret *domainReturns.Return) error
Update persists status transitions and timestamps.
type ReviewRepo ¶
type ReviewRepo struct {
// contains filtered or unexported fields
}
ReviewRepo implements review.Repository using PostgreSQL.
func NewReviewRepo ¶
func NewReviewRepo(db *sql.DB) (*ReviewRepo, error)
NewReviewRepo returns a new ReviewRepo backed by db.
func (*ReviewRepo) FindByID ¶
func (r *ReviewRepo) FindByID(ctx context.Context, id string) (*domainReview.Review, error)
FindByID returns a review by ID.
func (*ReviewRepo) FindByProductAndCustomer ¶
func (r *ReviewRepo) FindByProductAndCustomer(ctx context.Context, productID, customerID string) (*domainReview.Review, error)
FindByProductAndCustomer returns a review for the product/customer pair.
func (*ReviewRepo) List ¶
func (r *ReviewRepo) List(ctx context.Context, status domainReview.Status, offset, limit int) ([]domainReview.Review, error)
List returns reviews with optional status filter.
func (*ReviewRepo) ListApprovedByProduct ¶
func (r *ReviewRepo) ListApprovedByProduct(ctx context.Context, productID string, offset, limit int) ([]domainReview.Review, error)
ListApprovedByProduct returns approved reviews with reviewer first name.
func (*ReviewRepo) Save ¶
func (r *ReviewRepo) Save(ctx context.Context, rev *domainReview.Review) error
Save inserts a new review.
func (*ReviewRepo) SummaryByProduct ¶
func (r *ReviewRepo) SummaryByProduct(ctx context.Context, productID string) (domainReview.ProductSummary, error)
SummaryByProduct returns aggregate stats for approved reviews.
func (*ReviewRepo) Update ¶
func (r *ReviewRepo) Update(ctx context.Context, rev *domainReview.Review, priorStatus domainReview.Status) error
Update persists moderation transitions when the review still has priorStatus.
type RewriteRepo ¶
type RewriteRepo struct {
// contains filtered or unexported fields
}
RewriteRepo implements routing.RewriteRepository using PostgreSQL.
func NewRewriteRepo ¶
func NewRewriteRepo(db *sql.DB) (*RewriteRepo, error)
NewRewriteRepo returns a new RewriteRepo backed by db.
func (*RewriteRepo) Delete ¶
func (r *RewriteRepo) Delete(ctx context.Context, path string) error
Delete removes the URL rewrite for the given path.
func (*RewriteRepo) FindByPath ¶
func (r *RewriteRepo) FindByPath(ctx context.Context, path string) (*routing.URLRewrite, error)
FindByPath returns a URL rewrite for the given path. Returns (nil, nil) when not found.
func (*RewriteRepo) Save ¶
func (r *RewriteRepo) Save(ctx context.Context, rw *routing.URLRewrite) error
Save inserts or updates a URL rewrite.
type RolePermissionRepo ¶
type RolePermissionRepo struct {
// contains filtered or unexported fields
}
RolePermissionRepo implements rbac.Repository using PostgreSQL.
func NewRolePermissionRepo ¶
func NewRolePermissionRepo(db *sql.DB) (*RolePermissionRepo, error)
NewRolePermissionRepo returns a RolePermissionRepo backed by db.
func (*RolePermissionRepo) EnsurePermissions ¶
func (r *RolePermissionRepo) EnsurePermissions(ctx context.Context, role identity.Role, perms []rbac.Permission) error
EnsurePermissions inserts missing role/permission pairs.
func (*RolePermissionRepo) ListAll ¶
func (r *RolePermissionRepo) ListAll(ctx context.Context) (map[identity.Role][]rbac.Permission, error)
ListAll returns permissions grouped by admin role.
func (*RolePermissionRepo) ReplaceForRole ¶
func (r *RolePermissionRepo) ReplaceForRole(ctx context.Context, role identity.Role, perms []rbac.Permission) error
ReplaceForRole replaces all permissions for a role.
type SearchEngine ¶
type SearchEngine struct {
// contains filtered or unexported fields
}
SearchEngine implements search.SearchEngine using PostgreSQL full-text search.
func NewSearchEngine ¶
func NewSearchEngine(db *sql.DB) (*SearchEngine, error)
NewSearchEngine returns a new SearchEngine backed by db.
func (*SearchEngine) IndexProduct ¶
IndexProduct updates the search vector for a product. The search_vector trigger on the products table handles normal INSERT/UPDATE, so this method is primarily useful for explicit reindexing.
func (*SearchEngine) RemoveProduct ¶
func (e *SearchEngine) RemoveProduct(ctx context.Context, productID string) error
RemoveProduct clears the search vector for a product, making it unsearchable.
func (*SearchEngine) Search ¶
func (e *SearchEngine) Search(ctx context.Context, query search.SearchQuery) (search.SearchResult, error)
Search executes a full-text search query with optional filters, sorting, and facets.
func (*SearchEngine) Suggest ¶
func (e *SearchEngine) Suggest(ctx context.Context, prefix string, limit int) ([]search.Suggestion, error)
Suggest returns autocomplete suggestions using prefix matching on product names.
type ShippingRepo ¶
type ShippingRepo struct {
// contains filtered or unexported fields
}
ShippingRepo implements shipping.ShipmentRepository using PostgreSQL.
func NewShippingRepo ¶
func NewShippingRepo(db *sql.DB) (*ShippingRepo, error)
NewShippingRepo returns a new ShippingRepo backed by db.
func (*ShippingRepo) FindByID ¶
FindByID returns a shipment by its ID. Returns (nil, nil) when not found.
func (*ShippingRepo) FindByOrderID ¶
func (r *ShippingRepo) FindByOrderID(ctx context.Context, orderID string) (*shipping.Shipment, error)
FindByOrderID returns the shipment for a given order. Returns (nil, nil) when no shipment exists for the order.
func (*ShippingRepo) UpdateStatus ¶
func (r *ShippingRepo) UpdateStatus(ctx context.Context, s *shipping.Shipment, prevUpdatedAt time.Time) error
UpdateStatus updates the status, tracking_number, provider_ref, and updated_at of a shipment. Uses optimistic locking via updated_at to detect concurrent modifications.
type StatsRepo ¶
type StatsRepo struct {
// contains filtered or unexported fields
}
StatsRepo implements admin.StatsRepository using PostgreSQL.
func NewStatsRepo ¶
NewStatsRepo returns a new StatsRepo backed by db.
func (*StatsRepo) GetDashboardStats ¶
func (r *StatsRepo) GetDashboardStats(ctx context.Context, lowStockThreshold, recentLimit int) (admin.DashboardStats, error)
GetDashboardStats returns the dashboard overview aggregations.
type StockRepo ¶
type StockRepo struct {
// contains filtered or unexported fields
}
StockRepo implements inventory.StockRepository using PostgreSQL.
func NewStockRepo ¶
NewStockRepo returns a new StockRepo backed by db.
func (*StockRepo) GetInventoryItem ¶
func (r *StockRepo) GetInventoryItem(ctx context.Context, variantID string) (inventory.InventoryListItem, error)
GetInventoryItem returns the admin inventory view for a single variant.
func (*StockRepo) GetStock ¶
GetStock returns the stock entry for a variant. Returns a zero-quantity entry when no record exists.
func (*StockRepo) ListInventory ¶
func (r *StockRepo) ListInventory(ctx context.Context, offset, limit int, search string) ([]inventory.InventoryListItem, error)
ListInventory returns a paginated admin inventory view for all variants.
func (*StockRepo) ListStock ¶
func (r *StockRepo) ListStock(ctx context.Context, offset, limit int) ([]inventory.StockEntry, error)
ListStock returns a page of stock entries ordered by variant_id.
type StoreCreditRepo ¶
type StoreCreditRepo struct {
// contains filtered or unexported fields
}
StoreCreditRepo implements storecredit.Repository.
func NewStoreCreditRepo ¶
func NewStoreCreditRepo(db *sql.DB) (*StoreCreditRepo, error)
NewStoreCreditRepo creates a StoreCreditRepo.
func (*StoreCreditRepo) GetBalance ¶
func (*StoreCreditRepo) ListLedger ¶
func (r *StoreCreditRepo) ListLedger(ctx context.Context, customerID, currency string, offset, limit int) ([]storecredit.Entry, error)
type StoreRepo ¶
type StoreRepo struct {
// contains filtered or unexported fields
}
StoreRepo implements store.StoreRepository using PostgreSQL.
func NewStoreRepo ¶
NewStoreRepo returns a new StoreRepo backed by db.
func (*StoreRepo) FindByCode ¶
FindByCode returns a store by its unique code.
func (*StoreRepo) FindByDomain ¶
FindByDomain returns a store by its domain.
func (*StoreRepo) FindDefault ¶
FindDefault returns the default store.
type TaxRateRepo ¶
type TaxRateRepo struct {
// contains filtered or unexported fields
}
TaxRateRepo implements tax.RateRepository using PostgreSQL.
func NewTaxRateRepo ¶
func NewTaxRateRepo(db *sql.DB) (*TaxRateRepo, error)
NewTaxRateRepo returns a new TaxRateRepo backed by db.
func (*TaxRateRepo) CreateIfNotExists ¶
CreateIfNotExists inserts a rate for a country+class+store tuple and leaves existing rows untouched. It returns true when a row was inserted.
func (*TaxRateRepo) Delete ¶
func (r *TaxRateRepo) Delete(ctx context.Context, id string) error
Delete removes a tax rate by ID.
func (*TaxRateRepo) FindByCountryClassAndStore ¶
func (r *TaxRateRepo) FindByCountryClassAndStore(ctx context.Context, country, class, storeID string) (*tax.TaxRate, error)
FindByCountryClassAndStore returns the rate for a country+class+store tuple. An empty storeID means the global/default rate. Returns (nil, nil) when no rate exists.
func (*TaxRateRepo) ListByCountry ¶
ListByCountry returns all rates for a country, ordered by class then store_id.
func (*TaxRateRepo) WithTx ¶
func (r *TaxRateRepo) WithTx(tx *sql.Tx) *TaxRateRepo
WithTx returns a repo bound to the given transaction.
type TranslationRepo ¶
type TranslationRepo struct {
// contains filtered or unexported fields
}
TranslationRepo implements translation.TranslationRepository using PostgreSQL.
func NewTranslationRepo ¶
func NewTranslationRepo(db *sql.DB) (*TranslationRepo, error)
NewTranslationRepo returns a new TranslationRepo backed by db.
func (*TranslationRepo) Delete ¶
func (r *TranslationRepo) Delete(ctx context.Context, key, language string) error
Delete removes a translation by key and language.
func (*TranslationRepo) FindByKeyAndLanguage ¶
func (r *TranslationRepo) FindByKeyAndLanguage(ctx context.Context, key, language string) (*translation.Translation, error)
FindByKeyAndLanguage returns a single translation. Returns (nil, nil) when not found.
func (*TranslationRepo) ListByLanguage ¶
func (r *TranslationRepo) ListByLanguage(ctx context.Context, language string) ([]translation.Translation, error)
ListByLanguage returns all translations for a language, ordered by key.
func (*TranslationRepo) Upsert ¶
func (r *TranslationRepo) Upsert(ctx context.Context, t *translation.Translation) error
Upsert creates or updates a translation for a key+language pair.
type VariantRepo ¶
type VariantRepo struct {
// contains filtered or unexported fields
}
VariantRepo implements catalog.VariantRepository using PostgreSQL.
func NewVariantRepo ¶
func NewVariantRepo(db *sql.DB) (*VariantRepo, error)
NewVariantRepo returns a new VariantRepo backed by db.
func (*VariantRepo) FindByID ¶
FindByID returns a variant by its ID. Returns (nil, nil) when the variant does not exist.
func (*VariantRepo) FindBySKU ¶
FindBySKU returns a variant by its SKU. Returns (nil, nil) when no variant matches the SKU.
func (*VariantRepo) FindBySKUs ¶
func (r *VariantRepo) FindBySKUs(ctx context.Context, skus []string) (map[string]*catalog.Variant, error)
FindBySKUs returns variants keyed by SKU for the given SKUs.
func (*VariantRepo) ListByProductID ¶
func (r *VariantRepo) ListByProductID(ctx context.Context, productID string, offset, limit int) ([]catalog.Variant, error)
ListByProductID returns variants for the given product ordered by created_at asc.
func (*VariantRepo) ListByProductIDs ¶
func (r *VariantRepo) ListByProductIDs(ctx context.Context, productIDs []string, limitPerProduct int) (map[string][]catalog.Variant, error)
ListByProductIDs returns variants grouped by product ID.
func (*VariantRepo) WithTx ¶
func (r *VariantRepo) WithTx(tx *sql.Tx) catalog.VariantRepository
WithTx returns a repo bound to the given transaction.
type WebhookEndpointRepo ¶
type WebhookEndpointRepo struct {
// contains filtered or unexported fields
}
WebhookEndpointRepo implements domainwebhook.Repository.
func NewWebhookEndpointRepo ¶
func NewWebhookEndpointRepo(db *sql.DB) (*WebhookEndpointRepo, error)
NewWebhookEndpointRepo returns a WebhookEndpointRepo backed by db.
func (*WebhookEndpointRepo) Create ¶
func (r *WebhookEndpointRepo) Create(ctx context.Context, endpoint *domainwebhook.Endpoint) error
func (*WebhookEndpointRepo) Delete ¶
func (r *WebhookEndpointRepo) Delete(ctx context.Context, endpointID string) error
func (*WebhookEndpointRepo) FindByID ¶
func (r *WebhookEndpointRepo) FindByID(ctx context.Context, endpointID string) (*domainwebhook.Endpoint, error)
func (*WebhookEndpointRepo) List ¶
func (r *WebhookEndpointRepo) List(ctx context.Context) ([]domainwebhook.Endpoint, error)
func (*WebhookEndpointRepo) ListActive ¶
func (r *WebhookEndpointRepo) ListActive(ctx context.Context) ([]domainwebhook.Endpoint, error)
func (*WebhookEndpointRepo) Update ¶
func (r *WebhookEndpointRepo) Update(ctx context.Context, endpoint *domainwebhook.Endpoint) error
type ZoneRepo ¶
type ZoneRepo struct {
// contains filtered or unexported fields
}
ZoneRepo implements shipping.ZoneRepository using PostgreSQL.
func NewZoneRepo ¶
NewZoneRepo returns a new ZoneRepo backed by db.
func (*ZoneRepo) CreateRateTier ¶
CreateRateTier persists a new rate tier.
func (*ZoneRepo) CreateZone ¶
CreateZone persists a new shipping zone.
func (*ZoneRepo) DeleteRateTier ¶
DeleteRateTier removes a rate tier by ID.
func (*ZoneRepo) DeleteZone ¶
DeleteZone removes a zone and its rate tiers (cascaded by FK).
func (*ZoneRepo) FindRateTierByID ¶
FindRateTierByID returns a rate tier by its ID. Returns (nil, nil) when not found.
func (*ZoneRepo) FindZoneByID ¶
FindZoneByID returns a zone by its ID. Returns (nil, nil) when not found.
func (*ZoneRepo) ListRateTiers ¶
ListRateTiers returns all rate tiers for a zone ordered by min_weight.
func (*ZoneRepo) UpdateRateTier ¶
UpdateRateTier updates a rate tier's fields.
Source Files
¶
- asset_repo.go
- audit_log_repo.go
- cache_store.go
- cart_repo.go
- category_repo.go
- collection_repo.go
- config_repo.go
- consent_repo.go
- content_block_repo.go
- content_translation_repo.go
- coupon_repo.go
- credit_note_repo.go
- customer_address_repo.go
- customer_repo.go
- extension_field_repo.go
- extension_value_repo.go
- integration_idempotency_admin.go
- integration_idempotency_repo.go
- invoice_repo.go
- job_queue.go
- menu_repo.go
- mfa_repo.go
- order_repo.go
- page_repo.go
- payment_repo.go
- price_history_repo.go
- price_repo.go
- product_repo.go
- promotion_repo.go
- reservation_repo.go
- reset_token_repo.go
- return_repo.go
- review_repo.go
- rewrite_repo.go
- role_permission_repo.go
- search_engine.go
- shipping_repo.go
- stats_repo.go
- stock_repo.go
- store_credit_repo.go
- store_repo.go
- tax_rate_repo.go
- translation_repo.go
- variant_repo.go
- webhook_endpoint_repo.go
- zone_repo.go