Documentation
¶
Index ¶
- Constants
- func GenerateShortID() string
- func IsShortID(id string) bool
- func NormalizeID(id string) string
- func ShortenID(id string) string
- func UnshortenID(id string) string
- type Category
- func (category *Category) GetCreatedAt() string
- func (category *Category) GetCreatedAtCarbon() *carbon.Carbon
- func (category *Category) GetDescription() string
- func (category *Category) GetID() string
- func (category *Category) GetMemo() string
- func (category *Category) GetMeta(name string) string
- func (category *Category) GetMetas() (map[string]string, error)
- func (category *Category) GetParentID() string
- func (category *Category) GetSoftDeletedAt() string
- func (category *Category) GetSoftDeletedAtCarbon() *carbon.Carbon
- func (category *Category) GetStatus() string
- func (category *Category) GetTitle() string
- func (category *Category) GetUpdatedAt() string
- func (category *Category) GetUpdatedAtCarbon() *carbon.Carbon
- func (category *Category) IsActive() bool
- func (category *Category) IsChild() bool
- func (category *Category) IsDraft() bool
- func (category *Category) IsInactive() bool
- func (category *Category) IsRoot() bool
- func (category *Category) IsSoftDeleted() bool
- func (category *Category) MetaRemove(name string) error
- func (category *Category) MetasRemove(names []string) error
- func (category *Category) MetasUpsert(metas map[string]string) error
- func (category *Category) SetCreatedAt(createdAt string) CategoryInterface
- func (category *Category) SetDescription(description string) CategoryInterface
- func (category *Category) SetID(id string) CategoryInterface
- func (category *Category) SetMemo(memo string) CategoryInterface
- func (category *Category) SetMeta(name string, value string) error
- func (category *Category) SetMetas(metas map[string]string) error
- func (category *Category) SetParentID(parentID string) CategoryInterface
- func (category *Category) SetSoftDeletedAt(softDeletedAt string) CategoryInterface
- func (category *Category) SetStatus(status string) CategoryInterface
- func (category *Category) SetTitle(title string) CategoryInterface
- func (category *Category) SetUpdatedAt(updatedAt string) CategoryInterface
- type CategoryInterface
- type CategoryQueryInterface
- type Discount
- func (d *Discount) GetAmount() float64
- func (d *Discount) GetCode() string
- func (d *Discount) GetCreatedAt() string
- func (d *Discount) GetCreatedAtCarbon() *carbon.Carbon
- func (d *Discount) GetDescription() string
- func (d *Discount) GetEndsAt() string
- func (d *Discount) GetEndsAtCarbon() *carbon.Carbon
- func (d *Discount) GetID() string
- func (d *Discount) GetMemo() string
- func (d *Discount) GetMeta(name string) string
- func (d *Discount) GetMetas() (map[string]string, error)
- func (d *Discount) GetSoftDeletedAt() string
- func (d *Discount) GetSoftDeletedAtCarbon() *carbon.Carbon
- func (d *Discount) GetStartsAt() string
- func (d *Discount) GetStartsAtCarbon() *carbon.Carbon
- func (d *Discount) GetStatus() string
- func (d *Discount) GetTitle() string
- func (d *Discount) GetType() string
- func (d *Discount) GetUpdatedAt() string
- func (d *Discount) GetUpdatedAtCarbon() *carbon.Carbon
- func (d *Discount) IsActive() bool
- func (d *Discount) IsDraft() bool
- func (d *Discount) IsEnded() bool
- func (d *Discount) IsExpired() bool
- func (d *Discount) IsInactive() bool
- func (d *Discount) IsStarted() bool
- func (d *Discount) IsValidNow() bool
- func (d *Discount) MetaRemove(name string) error
- func (d *Discount) MetasRemove(names []string) error
- func (d *Discount) MetasUpsert(metas map[string]string) error
- func (d *Discount) SetAmount(amount float64) DiscountInterface
- func (d *Discount) SetCode(code string) DiscountInterface
- func (d *Discount) SetCreatedAt(createdAt string) DiscountInterface
- func (d *Discount) SetDescription(description string) DiscountInterface
- func (d *Discount) SetEndsAt(endsAt string) DiscountInterface
- func (d *Discount) SetID(id string) DiscountInterface
- func (d *Discount) SetMemo(memo string) DiscountInterface
- func (d *Discount) SetMeta(name string, value string) error
- func (d *Discount) SetMetas(metas map[string]string) error
- func (d *Discount) SetSoftDeletedAt(deletedAt string) DiscountInterface
- func (d *Discount) SetStartsAt(startsAt string) DiscountInterface
- func (d *Discount) SetStatus(status string) DiscountInterface
- func (d *Discount) SetTitle(title string) DiscountInterface
- func (d *Discount) SetType(type_ string) DiscountInterface
- func (d *Discount) SetUpdatedAt(updatedAt string) DiscountInterface
- type DiscountInterface
- type DiscountQueryInterface
- type Media
- func (m *Media) GetCreatedAt() string
- func (m *Media) GetCreatedAtCarbon() *carbon.Carbon
- func (m *Media) GetDescription() string
- func (m *Media) GetEntityID() string
- func (m *Media) GetID() string
- func (m *Media) GetMemo() string
- func (m *Media) GetMeta(name string) string
- func (m *Media) GetMetas() (map[string]string, error)
- func (m *Media) GetSequence() int
- func (m *Media) GetSoftDeletedAt() string
- func (m *Media) GetSoftDeletedAtCarbon() *carbon.Carbon
- func (m *Media) GetStatus() string
- func (m *Media) GetTitle() string
- func (m *Media) GetType() string
- func (m *Media) GetURL() string
- func (m *Media) GetUpdatedAt() string
- func (m *Media) GetUpdatedAtCarbon() *carbon.Carbon
- func (m *Media) IsActive() bool
- func (m *Media) IsDraft() bool
- func (m *Media) IsImage() bool
- func (m *Media) IsInactive() bool
- func (m *Media) IsSoftDeleted() bool
- func (m *Media) IsVideo() bool
- func (m *Media) MetaRemove(name string) error
- func (m *Media) MetasRemove(names []string) error
- func (m *Media) MetasUpsert(metas map[string]string) error
- func (m *Media) SetCreatedAt(createdAt string) MediaInterface
- func (m *Media) SetDescription(description string) MediaInterface
- func (m *Media) SetEntityID(entityID string) MediaInterface
- func (m *Media) SetID(id string) MediaInterface
- func (m *Media) SetMemo(memo string) MediaInterface
- func (m *Media) SetMeta(name string, value string) error
- func (m *Media) SetMetas(metas map[string]string) error
- func (m *Media) SetSequence(sequence int) MediaInterface
- func (m *Media) SetSoftDeletedAt(softDeletedAt string) MediaInterface
- func (m *Media) SetStatus(status string) MediaInterface
- func (m *Media) SetTitle(title string) MediaInterface
- func (m *Media) SetType(type_ string) MediaInterface
- func (m *Media) SetURL(url string) MediaInterface
- func (m *Media) SetUpdatedAt(updatedAt string) MediaInterface
- type MediaInterface
- type MediaQueryInterface
- type NewStoreOptions
- type Order
- func (order *Order) GetCreatedAt() string
- func (order *Order) GetCreatedAtCarbon() *carbon.Carbon
- func (order *Order) GetCustomerID() string
- func (order *Order) GetID() string
- func (order *Order) GetMemo() string
- func (order *Order) GetMeta(name string) string
- func (order *Order) GetMetas() (map[string]string, error)
- func (order *Order) GetPrice() string
- func (order *Order) GetPriceFloat() float64
- func (order *Order) GetQuantity() string
- func (order *Order) GetQuantityInt() int64
- func (order *Order) GetSoftDeletedAt() string
- func (order *Order) GetSoftDeletedAtCarbon() *carbon.Carbon
- func (order *Order) GetStatus() string
- func (order *Order) GetUpdatedAt() string
- func (order *Order) GetUpdatedAtCarbon() *carbon.Carbon
- func (order *Order) IsAwaitingFulfillment() bool
- func (order *Order) IsAwaitingPayment() bool
- func (order *Order) IsAwaitingPickup() bool
- func (order *Order) IsAwaitingShipment() bool
- func (order *Order) IsCancelled() bool
- func (order *Order) IsCompleted() bool
- func (order *Order) IsDeclined() bool
- func (order *Order) IsDisputed() bool
- func (order *Order) IsManualVerificationRequired() bool
- func (order *Order) IsPending() bool
- func (order *Order) IsRefunded() bool
- func (order *Order) IsShipped() bool
- func (order *Order) MetaRemove(name string) error
- func (order *Order) MetasRemove(names []string) error
- func (order *Order) MetasUpsert(metas map[string]string) error
- func (order *Order) SetCreatedAt(createdAt string) OrderInterface
- func (order *Order) SetCustomerID(id string) OrderInterface
- func (order *Order) SetID(id string) OrderInterface
- func (order *Order) SetMemo(memo string) OrderInterface
- func (order *Order) SetMeta(name string, value string) error
- func (order *Order) SetMetas(metas map[string]string) error
- func (order *Order) SetPrice(price string) OrderInterface
- func (order *Order) SetPriceFloat(price float64) OrderInterface
- func (order *Order) SetQuantity(quantity string) OrderInterface
- func (order *Order) SetQuantityInt(quantity int64) OrderInterface
- func (order *Order) SetSoftDeletedAt(deletedAt string) OrderInterface
- func (order *Order) SetStatus(status string) OrderInterface
- func (order *Order) SetUpdatedAt(updatedAt string) OrderInterface
- type OrderInterface
- type OrderLineItem
- func (o *OrderLineItem) GetCreatedAt() string
- func (o *OrderLineItem) GetCreatedAtCarbon() *carbon.Carbon
- func (o *OrderLineItem) GetID() string
- func (o *OrderLineItem) GetMemo() string
- func (o *OrderLineItem) GetMeta(name string) string
- func (o *OrderLineItem) GetMetas() (map[string]string, error)
- func (o *OrderLineItem) GetOrderID() string
- func (o *OrderLineItem) GetPrice() string
- func (o *OrderLineItem) GetPriceFloat() float64
- func (o *OrderLineItem) GetProductID() string
- func (o *OrderLineItem) GetQuantity() string
- func (o *OrderLineItem) GetQuantityInt() int64
- func (o *OrderLineItem) GetSoftDeletedAt() string
- func (o *OrderLineItem) GetSoftDeletedAtCarbon() *carbon.Carbon
- func (o *OrderLineItem) GetStatus() string
- func (o *OrderLineItem) GetTitle() string
- func (o *OrderLineItem) GetUpdatedAt() string
- func (o *OrderLineItem) GetUpdatedAtCarbon() *carbon.Carbon
- func (o *OrderLineItem) HasQuantity() bool
- func (o *OrderLineItem) IsActive() bool
- func (o *OrderLineItem) IsCancelled() bool
- func (o *OrderLineItem) IsCompleted() bool
- func (o *OrderLineItem) IsDraft() bool
- func (o *OrderLineItem) IsFree() bool
- func (o *OrderLineItem) MetaRemove(name string) error
- func (o *OrderLineItem) MetasRemove(names []string) error
- func (o *OrderLineItem) MetasUpsert(metas map[string]string) error
- func (o *OrderLineItem) SetCreatedAt(createdAt string) OrderLineItemInterface
- func (o *OrderLineItem) SetID(id string) OrderLineItemInterface
- func (o *OrderLineItem) SetMemo(memo string) OrderLineItemInterface
- func (o *OrderLineItem) SetMeta(name string, value string) error
- func (o *OrderLineItem) SetMetas(metas map[string]string) error
- func (o *OrderLineItem) SetOrderID(orderID string) OrderLineItemInterface
- func (o *OrderLineItem) SetPrice(price string) OrderLineItemInterface
- func (o *OrderLineItem) SetPriceFloat(price float64) OrderLineItemInterface
- func (o *OrderLineItem) SetProductID(productID string) OrderLineItemInterface
- func (o *OrderLineItem) SetQuantity(quantity string) OrderLineItemInterface
- func (o *OrderLineItem) SetQuantityInt(quantity int64) OrderLineItemInterface
- func (o *OrderLineItem) SetSoftDeletedAt(deletedAt string) OrderLineItemInterface
- func (o *OrderLineItem) SetStatus(status string) OrderLineItemInterface
- func (o *OrderLineItem) SetTitle(title string) OrderLineItemInterface
- func (o *OrderLineItem) SetUpdatedAt(updatedAt string) OrderLineItemInterface
- type OrderLineItemInterface
- type OrderLineItemQueryInterface
- type OrderQueryInterface
- type Product
- func (product *Product) GetCreatedAt() string
- func (product *Product) GetCreatedAtCarbon() *carbon.Carbon
- func (product *Product) GetDescription() string
- func (product *Product) GetID() string
- func (product *Product) GetMemo() string
- func (product *Product) GetMeta(name string) string
- func (product *Product) GetMetas() (map[string]string, error)
- func (product *Product) GetParentID() string
- func (product *Product) GetPrice() string
- func (product *Product) GetPriceFloat() float64
- func (product *Product) GetQuantity() string
- func (product *Product) GetQuantityInt() int64
- func (product *Product) GetShortDescription() string
- func (product *Product) GetSoftDeletedAt() string
- func (product *Product) GetSoftDeletedAtCarbon() *carbon.Carbon
- func (product *Product) GetStatus() string
- func (product *Product) GetTitle() string
- func (product *Product) GetUpdatedAt() string
- func (product *Product) GetUpdatedAtCarbon() *carbon.Carbon
- func (product *Product) GetVariantMatrixSchema() (VariantMatrixSchema, error)
- func (product *Product) GetVariantMatrixValues() (map[string]string, error)
- func (product *Product) HasStock() bool
- func (product *Product) HasVariantMatrixSchema() bool
- func (product *Product) IsActive() bool
- func (product *Product) IsDisabled() bool
- func (product *Product) IsDraft() bool
- func (product *Product) IsFree() bool
- func (product *Product) IsOutOfStock() bool
- func (product *Product) IsPaid() bool
- func (product *Product) IsParent() bool
- func (product *Product) IsSoftDeleted() bool
- func (product *Product) IsVariant() bool
- func (product *Product) MetaRemove(name string) error
- func (product *Product) MetasRemove(names []string) error
- func (product *Product) MetasUpsert(metas map[string]string) error
- func (product *Product) SetCreatedAt(createdAt string) ProductInterface
- func (product *Product) SetDescription(description string) ProductInterface
- func (product *Product) SetID(id string) ProductInterface
- func (product *Product) SetMemo(memo string) ProductInterface
- func (product *Product) SetMeta(name string, value string) error
- func (product *Product) SetMetas(metas map[string]string) error
- func (product *Product) SetParentID(parentID string) ProductInterface
- func (product *Product) SetPrice(price string) ProductInterface
- func (product *Product) SetPriceFloat(price float64) ProductInterface
- func (product *Product) SetQuantity(quantity string) ProductInterface
- func (product *Product) SetQuantityInt(quantity int64) ProductInterface
- func (product *Product) SetShortDescription(shortDescription string) ProductInterface
- func (product *Product) SetSoftDeletedAt(deletedAt string) ProductInterface
- func (product *Product) SetStatus(status string) ProductInterface
- func (product *Product) SetTitle(title string) ProductInterface
- func (product *Product) SetUpdatedAt(updatedAt string) ProductInterface
- func (product *Product) SetVariantMatrixSchema(schema VariantMatrixSchema) error
- func (product *Product) SetVariantMatrixValues(values map[string]string) error
- func (product *Product) Slug() string
- type ProductInterface
- type ProductQueryInterface
- type Store
- func (store *Store) AutoMigrate() error
- func (store *Store) CategoryCount(ctx context.Context, options CategoryQueryInterface) (int64, error)
- func (store *Store) CategoryCreate(ctx context.Context, category CategoryInterface) error
- func (store *Store) CategoryDelete(ctx context.Context, category CategoryInterface) error
- func (store *Store) CategoryDeleteByID(ctx context.Context, id string) error
- func (store *Store) CategoryFindByID(ctx context.Context, id string) (CategoryInterface, error)
- func (store *Store) CategoryList(ctx context.Context, options CategoryQueryInterface) ([]CategoryInterface, error)
- func (store *Store) CategorySoftDelete(ctx context.Context, category CategoryInterface) error
- func (store *Store) CategorySoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) CategoryTableName() string
- func (store *Store) CategoryUpdate(ctx context.Context, category CategoryInterface) (err error)
- func (store *Store) DB() *sql.DB
- func (store *Store) DiscountCount(ctx context.Context, options DiscountQueryInterface) (int64, error)
- func (store *Store) DiscountCreate(ctx context.Context, discount DiscountInterface) error
- func (store *Store) DiscountDelete(ctx context.Context, discount DiscountInterface) error
- func (store *Store) DiscountDeleteByID(ctx context.Context, id string) error
- func (store *Store) DiscountFindByCode(ctx context.Context, code string) (DiscountInterface, error)
- func (store *Store) DiscountFindByID(ctx context.Context, id string) (DiscountInterface, error)
- func (store *Store) DiscountList(ctx context.Context, options DiscountQueryInterface) ([]DiscountInterface, error)
- func (store *Store) DiscountSoftDelete(ctx context.Context, discount DiscountInterface) error
- func (store *Store) DiscountSoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) DiscountTableName() string
- func (store *Store) DiscountUpdate(ctx context.Context, discount DiscountInterface) error
- func (store *Store) EnableDebug(debug bool, sqlLogger ...*slog.Logger)
- func (store *Store) MediaCount(ctx context.Context, options MediaQueryInterface) (int64, error)
- func (store *Store) MediaCreate(ctx context.Context, media MediaInterface) error
- func (store *Store) MediaDelete(ctx context.Context, media MediaInterface) error
- func (store *Store) MediaDeleteByID(ctx context.Context, id string) error
- func (store *Store) MediaFindByID(ctx context.Context, id string) (MediaInterface, error)
- func (store *Store) MediaList(ctx context.Context, options MediaQueryInterface) ([]MediaInterface, error)
- func (store *Store) MediaSoftDelete(ctx context.Context, media MediaInterface) error
- func (store *Store) MediaSoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) MediaTableName() string
- func (store *Store) MediaUpdate(ctx context.Context, media MediaInterface) (err error)
- func (store *Store) OrderCount(ctx context.Context, options OrderQueryInterface) (int64, error)
- func (store *Store) OrderCreate(ctx context.Context, order OrderInterface) error
- func (store *Store) OrderDelete(ctx context.Context, order OrderInterface) error
- func (store *Store) OrderDeleteByID(ctx context.Context, id string) error
- func (store *Store) OrderFindByID(ctx context.Context, id string) (OrderInterface, error)
- func (store *Store) OrderLineItemCount(ctx context.Context, options OrderLineItemQueryInterface) (int64, error)
- func (store *Store) OrderLineItemCreate(ctx context.Context, orderLineItem OrderLineItemInterface) error
- func (store *Store) OrderLineItemDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
- func (store *Store) OrderLineItemDeleteByID(ctx context.Context, id string) error
- func (store *Store) OrderLineItemFindByID(ctx context.Context, id string) (OrderLineItemInterface, error)
- func (store *Store) OrderLineItemList(ctx context.Context, options OrderLineItemQueryInterface) ([]OrderLineItemInterface, error)
- func (store *Store) OrderLineItemSoftDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
- func (store *Store) OrderLineItemSoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) OrderLineItemTableName() string
- func (store *Store) OrderLineItemUpdate(ctx context.Context, orderLineItem OrderLineItemInterface) error
- func (store *Store) OrderList(ctx context.Context, options OrderQueryInterface) ([]OrderInterface, error)
- func (store *Store) OrderSoftDelete(ctx context.Context, order OrderInterface) error
- func (store *Store) OrderSoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) OrderTableName() string
- func (store *Store) OrderUpdate(ctx context.Context, order OrderInterface) error
- func (store *Store) ProductCount(ctx context.Context, options ProductQueryInterface) (int64, error)
- func (store *Store) ProductCreate(ctx context.Context, product ProductInterface) error
- func (store *Store) ProductDelete(ctx context.Context, product ProductInterface) error
- func (store *Store) ProductDeleteByID(ctx context.Context, id string) error
- func (store *Store) ProductFindByID(ctx context.Context, id string) (ProductInterface, error)
- func (store *Store) ProductGetParent(ctx context.Context, productID string) (ProductInterface, error)
- func (store *Store) ProductIsParent(ctx context.Context, productID string) (bool, error)
- func (store *Store) ProductList(ctx context.Context, options ProductQueryInterface) ([]ProductInterface, error)
- func (store *Store) ProductSoftDelete(ctx context.Context, product ProductInterface) error
- func (store *Store) ProductSoftDeleteByID(ctx context.Context, id string) error
- func (store *Store) ProductTableName() string
- func (store *Store) ProductUpdate(ctx context.Context, product ProductInterface) error
- func (store *Store) ProductVariantList(ctx context.Context, parentID string) ([]ProductInterface, error)
- type StoreInterface
- type VariantMatrixSchema
Constants ¶
const CATEGORY_STATUS_ACTIVE = "active"
const CATEGORY_STATUS_DRAFT = "draft"
const CATEGORY_STATUS_INACTIVE = "inactive"
const COLUMN_AMOUNT = "amount"
const COLUMN_CODE = "code"
const COLUMN_CREATED_AT = "created_at"
const COLUMN_CUSTOMER_ID = "customer_id"
const COLUMN_DESCRIPTION = "description"
const COLUMN_ENDS_AT = "ends_at"
const COLUMN_ENTITY_ID = "entity_id"
const COLUMN_ID = "id"
const COLUMN_MEDIA_TYPE = "media_type"
const COLUMN_MEDIA_URL = "media_url"
const COLUMN_MEMO = "memo"
const COLUMN_METAS = "metas"
const COLUMN_ORDER_ID = "order_id"
const COLUMN_PARENT_ID = "parent_id"
const COLUMN_PRICE = "price"
const COLUMN_PRODUCT_ID = "product_id"
const COLUMN_QUANTITY = "quantity"
const COLUMN_SEQUENCE = "sequence"
const COLUMN_SHORT_DESCRIPTION = "short_description"
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
const COLUMN_STARTS_AT = "starts_at"
const COLUMN_STATUS = "status"
const COLUMN_TITLE = "title"
const COLUMN_TYPE = "type"
const COLUMN_UPDATED_AT = "updated_at"
const COLUMN_VARIANT_MATRIX_SCHEMA = "variant_matrix_schema"
const COLUMN_VARIANT_MATRIX_VALUES = "variant_matrix_values"
const DISCOUNT_DURATION_FOREVER = "forever"
const DISCOUNT_DURATION_MONTHS = "months"
const DISCOUNT_DURATION_ONCE = "once"
const DISCOUNT_STATUS_ACTIVE = "active"
const DISCOUNT_STATUS_DRAFT = "draft"
const DISCOUNT_STATUS_INACTIVE = "inactive"
const DISCOUNT_TYPE_AMOUNT = "amount"
const DISCOUNT_TYPE_PERCENT = "percent"
const MEDIA_STATUS_ACTIVE = "active"
const MEDIA_STATUS_DRAFT = "draft"
const MEDIA_STATUS_INACTIVE = "inactive"
const MEDIA_TYPE_IMAGE_JPG = "image/jpeg"
const MEDIA_TYPE_IMAGE_PNG = "image/png"
const MEDIA_TYPE_VIDEO_MP4 = "video/mp4"
const ORDER_STATUS_AWAITING_FULFILLMENT = "awaiting_fulfillment"
Customer has completed the checkout process and payment has been confirmed.
const ORDER_STATUS_AWAITING_PAYMENT = "awaiting_payment"
Customer has completed the checkout process, but payment has yet to be confirmed.
const ORDER_STATUS_AWAITING_PICKUP = "awaiting_pickup"
Order has been packaged and is awaiting customer pickup from a seller-specified location.
const ORDER_STATUS_AWAITING_SHIPMENT = "awaiting_shipment"
Order has been pulled and packaged and is awaiting collection from a shipping provider.
const ORDER_STATUS_CANCELLED = "cancelled"
Seller has cancelled an order, due to a stock inconsistency or other reasons. Cancelling an order will not refund the order.
const ORDER_STATUS_COMPLETED = "completed"
Order has been shipped/picked up, and receipt is confirmed; client has paid for their digital product, and their file(s) are available for download.
const ORDER_STATUS_DECLINED = "declined"
Seller has marked the order as declined.
const ORDER_STATUS_DISPUTED = "disputed"
Customer has initiated a dispute resolution process for the PayPal transaction that paid for the order or the seller has marked the order as a fraudulent order.
const ORDER_STATUS_MANUAL_VERIFICATION_REQUIRED = "manual_verification_required"
Order on hold while some aspect, such as tax-exempt documentation, is manually confirmed. Orders with this status must be updated manually.
const ORDER_STATUS_PARTIALLY_REFUNDED = "partially_refunded"
Seller has partially refunded the order.
const ORDER_STATUS_PARTIALLY_SHIPPED = "partially_shipped"
Only some items in the order have been shipped.
const ORDER_STATUS_PENDING = "pending"
Customer started the checkout process but did not complete it.
const ORDER_STATUS_REFUNDED = "refunded"
Seller has used the Refund action to refund the whole order. A listing of all orders with a "Refunded" status can be found under the More tab of the View Orders screen.
const ORDER_STATUS_SHIPPED = "shipped"
Order has been shipped, but receipt has not been confirmed; seller has used the Ship Items action. A listing of all orders with a "Shipped" status can be found under the More tab of the View Orders screen.
const PRODUCT_STATUS_ACTIVE = "active"
const PRODUCT_STATUS_DISABLED = "disabled"
const PRODUCT_STATUS_DRAFT = "draft"
Variables ¶
This section is empty.
Functions ¶
func GenerateShortID ¶ added in v1.8.0
func GenerateShortID() string
GenerateShortID generates a new shortened ID using TimestampMicro + Crockford Base32 (lowercase) Returns a 9-character lowercase ID (e.g., "86ccrtsgx") Thread-safe: Uses mutex to prevent duplicate IDs when called concurrently
func IsShortID ¶ added in v1.8.0
IsShortID checks if an ID appears to be a shortened ID (9 or 21 chars) vs a long HumanUid ID (32 chars)
func NormalizeID ¶ added in v1.8.0
NormalizeID normalizes an ID to lowercase for consistent lookups Handles both short (9-char, 21-char) and long (32-char) ID formats
func ShortenID ¶ added in v1.8.0
ShortenID shortens a long ID to its shortened form - 9-char IDs: Return as-is (already shortened TimestampMicro) - 32-char IDs: Shorten to 21-char using Crockford - Other lengths: Return as-is
func UnshortenID ¶ added in v1.8.0
UnshortenID attempts to unshorten a shortened ID back to its original form Returns the original ID if it cannot be unshortened
Types ¶
type Category ¶
type Category struct {
dataobject.DataObject
}
Category represents a product category in the shop store. Categories support hierarchical structures with parent-child relationships, soft deletion, metadata storage, and status management.
func (*Category) GetCreatedAt ¶ added in v1.9.0
GetCreatedAt returns the creation timestamp as a string.
func (*Category) GetCreatedAtCarbon ¶ added in v1.9.0
GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
func (*Category) GetDescription ¶ added in v1.9.0
GetDescription returns the category description.
func (*Category) GetMeta ¶ added in v1.9.0
GetMeta returns a specific metadata value by name. Returns empty string if not found.
func (*Category) GetMetas ¶ added in v1.9.0
GetMetas returns all metadata as a map. Returns empty map if no metas stored.
func (*Category) GetParentID ¶ added in v1.9.0
GetParentID returns the parent category ID (empty if root category).
func (*Category) GetSoftDeletedAt ¶ added in v1.9.0
GetSoftDeletedAt returns the soft deletion timestamp.
func (*Category) GetSoftDeletedAtCarbon ¶ added in v1.9.0
GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
func (*Category) GetUpdatedAt ¶ added in v1.9.0
GetUpdatedAt returns the last update timestamp.
func (*Category) GetUpdatedAtCarbon ¶ added in v1.9.0
GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
func (*Category) IsChild ¶ added in v1.9.0
IsChild returns true if the category has a parent (parent_id is not empty)
func (*Category) IsInactive ¶
IsInactive returns true if the category status is inactive.
func (*Category) IsRoot ¶ added in v1.9.0
IsRoot returns true if the category has no parent (parent_id is empty)
func (*Category) IsSoftDeleted ¶
IsSoftDeleted returns true if the category is soft deleted.
func (*Category) MetaRemove ¶ added in v1.9.0
MetaRemove removes a single metadata entry.
func (*Category) MetasRemove ¶ added in v1.9.0
MetasRemove removes multiple metadata entries.
func (*Category) MetasUpsert ¶ added in v1.9.0
MetasUpsert merges the provided metadata with existing values.
func (*Category) SetCreatedAt ¶
func (category *Category) SetCreatedAt(createdAt string) CategoryInterface
SetCreatedAt sets the creation timestamp.
func (*Category) SetDescription ¶
func (category *Category) SetDescription(description string) CategoryInterface
SetDescription sets the category description.
func (*Category) SetID ¶
func (category *Category) SetID(id string) CategoryInterface
SetID sets the unique identifier.
func (*Category) SetMemo ¶
func (category *Category) SetMemo(memo string) CategoryInterface
SetMemo sets the internal memo.
func (*Category) SetMetas ¶
SetMetas replaces all metadata with the provided map. Warning: this overwrites any existing metadata.
func (*Category) SetParentID ¶
func (category *Category) SetParentID(parentID string) CategoryInterface
SetParentID sets the parent category ID. Empty string makes it a root category.
func (*Category) SetSoftDeletedAt ¶
func (category *Category) SetSoftDeletedAt(softDeletedAt string) CategoryInterface
SetSoftDeletedAt sets the soft deletion timestamp.
func (*Category) SetStatus ¶
func (category *Category) SetStatus(status string) CategoryInterface
SetStatus sets the current status.
func (*Category) SetTitle ¶
func (category *Category) SetTitle(title string) CategoryInterface
SetTitle sets the category title.
func (*Category) SetUpdatedAt ¶
func (category *Category) SetUpdatedAt(updatedAt string) CategoryInterface
SetUpdatedAt sets the last update timestamp.
type CategoryInterface ¶
type CategoryInterface interface {
// Data returns a map of all field values for serialization.
Data() map[string]string
// DataChanged returns a map of only the fields that have been modified since load.
DataChanged() map[string]string
// MarkAsNotDirty resets the dirty state, clearing all change tracking.
MarkAsNotDirty()
// GetCreatedAt returns the creation timestamp as a string.
GetCreatedAt() string
// GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
GetCreatedAtCarbon() *carbon.Carbon
// SetCreatedAt sets the creation timestamp.
SetCreatedAt(createdAt string) CategoryInterface
// GetDescription returns the category description.
GetDescription() string
// SetDescription sets the category description.
SetDescription(description string) CategoryInterface
// GetID returns the unique identifier.
GetID() string
// SetID sets the unique identifier.
SetID(id string) CategoryInterface
// GetMemo returns the internal memo.
GetMemo() string
// SetMemo sets the internal memo.
SetMemo(memo string) CategoryInterface
// GetMetas returns all metadata as a map.
GetMetas() (map[string]string, error)
// GetMeta returns a specific metadata value by name.
GetMeta(name string) string
// SetMeta sets a single metadata value.
SetMeta(name string, value string) error
// SetMetas replaces all metadata with the provided map.
SetMetas(metas map[string]string) error
// MetasUpsert merges the provided metadata with existing values.
MetasUpsert(metas map[string]string) error
// MetaRemove removes a single metadata entry.
MetaRemove(name string) error
// MetasRemove removes multiple metadata entries.
MetasRemove(names []string) error
// GetParentID returns the parent category ID (empty if root).
GetParentID() string
// SetParentID sets the parent category ID.
SetParentID(parentID string) CategoryInterface
// GetStatus returns the current status.
GetStatus() string
// SetStatus sets the current status.
SetStatus(status string) CategoryInterface
// GetTitle returns the category title.
GetTitle() string
// SetTitle sets the category title.
SetTitle(title string) CategoryInterface
// GetSoftDeletedAt returns the soft deletion timestamp.
GetSoftDeletedAt() string
// GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
GetSoftDeletedAtCarbon() *carbon.Carbon
// SetSoftDeletedAt sets the soft deletion timestamp.
SetSoftDeletedAt(deletedAt string) CategoryInterface
// GetUpdatedAt returns the last update timestamp.
GetUpdatedAt() string
// GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
GetUpdatedAtCarbon() *carbon.Carbon
// SetUpdatedAt sets the last update timestamp.
SetUpdatedAt(updatedAt string) CategoryInterface
// IsActive returns true if status is active.
IsActive() bool
// IsDraft returns true if status is draft.
IsDraft() bool
// IsInactive returns true if status is inactive.
IsInactive() bool
// IsSoftDeleted returns true if the category is soft deleted.
IsSoftDeleted() bool
// IsRoot returns true if this is a root category (no parent).
IsRoot() bool
// IsChild returns true if this category has a parent.
IsChild() bool
}
CategoryInterface defines the contract for category entities in the shop store. Categories support hierarchical structures (parent-child relationships), soft deletion, metadata storage, and status management.
func NewCategory ¶
func NewCategory() CategoryInterface
NewCategory creates a new category with default values: - Status: draft - ParentID: empty (root category) - Description: empty - Memo: empty - CreatedAt: current UTC time - UpdatedAt: current UTC time - SoftDeletedAt: max datetime (not deleted) - Metas: empty map
func NewCategoryFromExistingData ¶
func NewCategoryFromExistingData(data map[string]string) CategoryInterface
NewCategoryFromExistingData creates a category from existing data map. Used when hydrating from database or external sources.
type CategoryQueryInterface ¶
type CategoryQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) CategoryQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) CategoryQueryInterface
HasID() bool
ID() string
SetID(id string) CategoryQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) CategoryQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) CategoryQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) CategoryQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) CategoryQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) CategoryQueryInterface
HasParentID() bool
ParentID() string
SetParentID(parentID string) CategoryQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) CategoryQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) CategoryQueryInterface
HasTitleLike() bool
TitleLike() string
SetTitleLike(titleLike string) CategoryQueryInterface
// contains filtered or unexported methods
}
func NewCategoryQuery ¶
func NewCategoryQuery() CategoryQueryInterface
type Discount ¶
type Discount struct {
dataobject.DataObject
}
Discount represents a discount/promotion in the shop store. Discounts support temporal validity (start/end dates), amount-based discounts, soft deletion, metadata storage, and status management.
func (*Discount) GetCreatedAt ¶ added in v1.9.0
GetCreatedAt returns the creation timestamp as a string.
func (*Discount) GetCreatedAtCarbon ¶ added in v1.9.0
GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
func (*Discount) GetDescription ¶ added in v1.9.0
GetDescription returns the discount description.
func (*Discount) GetEndsAtCarbon ¶ added in v1.9.0
GetEndsAtCarbon returns the end date/time as a Carbon instance.
func (*Discount) GetMeta ¶ added in v1.9.0
GetMeta returns a specific metadata value by name. Returns empty string if not found.
func (*Discount) GetMetas ¶ added in v1.9.0
GetMetas returns all metadata as a map. Returns empty map if no metas stored.
func (*Discount) GetSoftDeletedAt ¶ added in v1.9.0
GetSoftDeletedAt returns the soft deletion timestamp.
func (*Discount) GetSoftDeletedAtCarbon ¶ added in v1.9.0
GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
func (*Discount) GetStartsAt ¶ added in v1.9.0
GetStartsAt returns the start date/time as a string.
func (*Discount) GetStartsAtCarbon ¶ added in v1.9.0
GetStartsAtCarbon returns the start date/time as a Carbon instance.
func (*Discount) GetUpdatedAt ¶ added in v1.9.0
GetUpdatedAt returns the last update timestamp.
func (*Discount) GetUpdatedAtCarbon ¶ added in v1.9.0
GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
func (*Discount) IsEnded ¶ added in v1.9.0
IsEnded returns true if the discount period has ended (ends_at <= now).
func (*Discount) IsInactive ¶ added in v1.9.0
IsInactive returns true if the discount status is inactive.
func (*Discount) IsStarted ¶ added in v1.9.0
IsStarted returns true if the discount period has started (starts_at <= now).
func (*Discount) IsValidNow ¶ added in v1.9.0
IsValidNow returns true if the discount is active, started, and not ended.
func (*Discount) MetaRemove ¶
MetaRemove removes a single metadata entry.
func (*Discount) MetasRemove ¶
MetasRemove removes multiple metadata entries.
func (*Discount) MetasUpsert ¶
MetasUpsert merges the provided metadata with existing values.
func (*Discount) SetAmount ¶
func (d *Discount) SetAmount(amount float64) DiscountInterface
SetAmount sets the discount amount.
func (*Discount) SetCode ¶
func (d *Discount) SetCode(code string) DiscountInterface
SetCode sets the unique discount code.
func (*Discount) SetCreatedAt ¶
func (d *Discount) SetCreatedAt(createdAt string) DiscountInterface
SetCreatedAt sets the creation timestamp.
func (*Discount) SetDescription ¶
func (d *Discount) SetDescription(description string) DiscountInterface
SetDescription sets the discount description.
func (*Discount) SetEndsAt ¶
func (d *Discount) SetEndsAt(endsAt string) DiscountInterface
SetEndsAt sets the end date/time.
func (*Discount) SetID ¶
func (d *Discount) SetID(id string) DiscountInterface
SetID sets the unique identifier.
func (*Discount) SetMemo ¶
func (d *Discount) SetMemo(memo string) DiscountInterface
SetMemo sets the internal memo.
func (*Discount) SetMetas ¶
SetMetas replaces all metadata with the provided map. Warning: this overwrites any existing metadata.
func (*Discount) SetSoftDeletedAt ¶
func (d *Discount) SetSoftDeletedAt(deletedAt string) DiscountInterface
SetSoftDeletedAt sets the soft deletion timestamp.
func (*Discount) SetStartsAt ¶
func (d *Discount) SetStartsAt(startsAt string) DiscountInterface
SetStartsAt sets the start date/time.
func (*Discount) SetStatus ¶
func (d *Discount) SetStatus(status string) DiscountInterface
SetStatus sets the current status.
func (*Discount) SetTitle ¶
func (d *Discount) SetTitle(title string) DiscountInterface
SetTitle sets the discount title.
func (*Discount) SetType ¶
func (d *Discount) SetType(type_ string) DiscountInterface
SetType sets the discount type.
func (*Discount) SetUpdatedAt ¶
func (d *Discount) SetUpdatedAt(updatedAt string) DiscountInterface
SetUpdatedAt sets the last update timestamp.
type DiscountInterface ¶
type DiscountInterface interface {
// Data returns a map of all field values for serialization.
Data() map[string]string
// DataChanged returns a map of only the fields that have been modified since load.
DataChanged() map[string]string
// MarkAsNotDirty resets the dirty state, clearing all change tracking.
MarkAsNotDirty()
// GetAmount returns the discount amount.
GetAmount() float64
// SetAmount sets the discount amount.
SetAmount(amount float64) DiscountInterface
// GetCode returns the unique discount code.
GetCode() string
// SetCode sets the unique discount code.
SetCode(code string) DiscountInterface
// GetCreatedAt returns the creation timestamp as a string.
GetCreatedAt() string
// GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
GetCreatedAtCarbon() *carbon.Carbon
// SetCreatedAt sets the creation timestamp.
SetCreatedAt(createdAt string) DiscountInterface
// GetDescription returns the discount description.
GetDescription() string
// SetDescription sets the discount description.
SetDescription(description string) DiscountInterface
// GetEndsAt returns the end date/time as a string.
GetEndsAt() string
// GetEndsAtCarbon returns the end date/time as a Carbon instance.
GetEndsAtCarbon() *carbon.Carbon
// SetEndsAt sets the end date/time.
SetEndsAt(endsAt string) DiscountInterface
// GetID returns the unique identifier.
GetID() string
// SetID sets the unique identifier.
SetID(id string) DiscountInterface
// GetMemo returns the internal memo.
GetMemo() string
// SetMemo sets the internal memo.
SetMemo(memo string) DiscountInterface
// GetMeta returns a specific metadata value by name.
GetMeta(name string) string
// GetMetas returns all metadata as a map.
GetMetas() (map[string]string, error)
// SetMeta sets a single metadata value.
SetMeta(name string, value string) error
// SetMetas replaces all metadata with the provided map.
SetMetas(metas map[string]string) error
// MetasUpsert merges the provided metadata with existing values.
MetasUpsert(metas map[string]string) error
// MetaRemove removes a single metadata entry.
MetaRemove(name string) error
// MetasRemove removes multiple metadata entries.
MetasRemove(names []string) error
// GetSoftDeletedAt returns the soft deletion timestamp.
GetSoftDeletedAt() string
// GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
GetSoftDeletedAtCarbon() *carbon.Carbon
// SetSoftDeletedAt sets the soft deletion timestamp.
SetSoftDeletedAt(deletedAt string) DiscountInterface
// GetStartsAt returns the start date/time as a string.
GetStartsAt() string
// GetStartsAtCarbon returns the start date/time as a Carbon instance.
GetStartsAtCarbon() *carbon.Carbon
// SetStartsAt sets the start date/time.
SetStartsAt(startsAt string) DiscountInterface
// GetStatus returns the current status.
GetStatus() string
// SetStatus sets the current status.
SetStatus(status string) DiscountInterface
// GetTitle returns the discount title.
GetTitle() string
// SetTitle sets the discount title.
SetTitle(title string) DiscountInterface
// GetType returns the discount type.
GetType() string
// SetType sets the discount type.
SetType(type_ string) DiscountInterface
// GetUpdatedAt returns the last update timestamp.
GetUpdatedAt() string
// GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
GetUpdatedAtCarbon() *carbon.Carbon
// SetUpdatedAt sets the last update timestamp.
SetUpdatedAt(updatedAt string) DiscountInterface
// IsActive returns true if status is active.
IsActive() bool
// IsDraft returns true if status is draft.
IsDraft() bool
// IsInactive returns true if status is inactive.
IsInactive() bool
// IsStarted returns true if the discount period has started.
IsStarted() bool
// IsEnded returns true if the discount period has ended.
IsEnded() bool
// IsExpired returns true if the discount is no longer valid.
IsExpired() bool
// IsValidNow returns true if the discount is currently valid (started and not ended).
IsValidNow() bool
}
DiscountInterface defines the contract for discount/promotion entities. Discounts support temporal validity (start/end dates), amount-based discounts, soft deletion, metadata storage, and status management.
func NewDiscount ¶
func NewDiscount() DiscountInterface
NewDiscount creates a new discount with default values: - Status: draft - Type: percent - Amount: 0.00 - Code: randomly generated 12-character code - Title: empty - Description: empty - StartsAt: null datetime - EndsAt: null datetime - Memo: empty - CreatedAt: current UTC time - UpdatedAt: current UTC time - SoftDeletedAt: max datetime (not deleted) - Metas: empty map
func NewDiscountFromExistingData ¶
func NewDiscountFromExistingData(data map[string]string) DiscountInterface
NewDiscountFromExistingData creates a discount from existing data map. Used when hydrating from database or external sources.
type DiscountQueryInterface ¶
type DiscountQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) DiscountQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) DiscountQueryInterface
HasCreatedAtGte() bool
CreatedAtGte() string
SetCreatedAtGte(createdAtGte string) DiscountQueryInterface
HasCreatedAtLte() bool
CreatedAtLte() string
SetCreatedAtLte(createdAtLte string) DiscountQueryInterface
HasCode() bool
Code() string
SetCode(code string) DiscountQueryInterface
HasEndsAtGte() bool
EndsAtGte() string
SetEndsAtGte(endsAtGte string) DiscountQueryInterface
HasEndsAtLte() bool
EndsAtLte() string
SetEndsAtLte(endsAtLte string) DiscountQueryInterface
HasID() bool
ID() string
SetID(id string) DiscountQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) DiscountQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) DiscountQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) DiscountQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(discountBy string) DiscountQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) DiscountQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) DiscountQueryInterface
HasStartsAtGte() bool
StartsAtGte() string
SetStartsAtGte(startsAtGte string) DiscountQueryInterface
HasStartsAtLte() bool
StartsAtLte() string
SetStartsAtLte(startsAtLte string) DiscountQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) DiscountQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) DiscountQueryInterface
HasType() bool
Type() string
SetType(discountType string) DiscountQueryInterface
// contains filtered or unexported methods
}
func NewDiscountQuery ¶
func NewDiscountQuery() DiscountQueryInterface
type Media ¶
type Media struct {
dataobject.DataObject
}
Media represents a media file (image, video, etc) in the shop store. Media files are associated with entities via EntityID, support sequencing for ordering, soft deletion, metadata storage, and type classification.
func (*Media) GetCreatedAt ¶ added in v1.9.0
GetCreatedAt returns the creation timestamp as a string.
func (*Media) GetCreatedAtCarbon ¶ added in v1.9.0
GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
func (*Media) GetDescription ¶ added in v1.9.0
GetDescription returns the media description.
func (*Media) GetEntityID ¶ added in v1.9.0
GetEntityID returns the associated entity ID.
func (*Media) GetMeta ¶ added in v1.9.0
GetMeta returns a specific metadata value by name. Returns empty string if not found.
func (*Media) GetMetas ¶ added in v1.9.0
GetMetas returns all metadata as a map. Returns empty map if no metas stored.
func (*Media) GetSequence ¶ added in v1.9.0
GetSequence returns the display sequence/order.
func (*Media) GetSoftDeletedAt ¶ added in v1.9.0
GetSoftDeletedAt returns the soft deletion timestamp.
func (*Media) GetSoftDeletedAtCarbon ¶ added in v1.9.0
GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
func (*Media) GetType ¶ added in v1.9.0
GetType returns the media type (e.g., image/jpeg, video/mp4).
func (*Media) GetUpdatedAt ¶ added in v1.9.0
GetUpdatedAt returns the last update timestamp.
func (*Media) GetUpdatedAtCarbon ¶ added in v1.9.0
GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
func (*Media) IsImage ¶ added in v1.9.0
IsImage returns true if the media type starts with "image/".
func (*Media) IsInactive ¶ added in v1.9.0
IsInactive returns true if the media status is inactive.
func (*Media) IsSoftDeleted ¶ added in v1.9.0
IsSoftDeleted returns true if the media is soft deleted.
func (*Media) IsVideo ¶ added in v1.9.0
IsVideo returns true if the media type starts with "video/".
func (*Media) MetaRemove ¶ added in v1.9.0
MetaRemove removes a single metadata entry.
func (*Media) MetasRemove ¶ added in v1.9.0
MetasRemove removes multiple metadata entries.
func (*Media) MetasUpsert ¶ added in v1.9.0
MetasUpsert merges the provided metadata with existing values.
func (*Media) SetCreatedAt ¶
func (m *Media) SetCreatedAt(createdAt string) MediaInterface
SetCreatedAt sets the creation timestamp.
func (*Media) SetDescription ¶
func (m *Media) SetDescription(description string) MediaInterface
SetDescription sets the media description.
func (*Media) SetEntityID ¶
func (m *Media) SetEntityID(entityID string) MediaInterface
SetEntityID sets the associated entity ID.
func (*Media) SetID ¶
func (m *Media) SetID(id string) MediaInterface
SetID sets the unique identifier.
func (*Media) SetMemo ¶
func (m *Media) SetMemo(memo string) MediaInterface
SetMemo sets the internal memo.
func (*Media) SetMetas ¶
SetMetas replaces all metadata with the provided map. Warning: this overwrites any existing metadata.
func (*Media) SetSequence ¶
func (m *Media) SetSequence(sequence int) MediaInterface
SetSequence sets the display sequence/order.
func (*Media) SetSoftDeletedAt ¶
func (m *Media) SetSoftDeletedAt(softDeletedAt string) MediaInterface
SetSoftDeletedAt sets the soft deletion timestamp.
func (*Media) SetStatus ¶
func (m *Media) SetStatus(status string) MediaInterface
SetStatus sets the current status.
func (*Media) SetTitle ¶
func (m *Media) SetTitle(title string) MediaInterface
SetTitle sets the media title.
func (*Media) SetType ¶
func (m *Media) SetType(type_ string) MediaInterface
SetType sets the media type.
func (*Media) SetURL ¶
func (m *Media) SetURL(url string) MediaInterface
SetURL sets the media file URL.
func (*Media) SetUpdatedAt ¶
func (m *Media) SetUpdatedAt(updatedAt string) MediaInterface
SetUpdatedAt sets the last update timestamp.
type MediaInterface ¶
type MediaInterface interface {
// Data returns a map of all field values for serialization.
Data() map[string]string
// DataChanged returns a map of only the fields that have been modified since load.
DataChanged() map[string]string
// MarkAsNotDirty resets the dirty state, clearing all change tracking.
MarkAsNotDirty()
// GetCreatedAt returns the creation timestamp as a string.
GetCreatedAt() string
// GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
GetCreatedAtCarbon() *carbon.Carbon
// SetCreatedAt sets the creation timestamp.
SetCreatedAt(createdAt string) MediaInterface
// GetDescription returns the media description.
GetDescription() string
// SetDescription sets the media description.
SetDescription(description string) MediaInterface
// GetEntityID returns the associated entity ID.
GetEntityID() string
// SetEntityID sets the associated entity ID.
SetEntityID(entityID string) MediaInterface
// GetID returns the unique identifier.
GetID() string
// SetID sets the unique identifier.
SetID(id string) MediaInterface
// GetMemo returns the internal memo.
GetMemo() string
// SetMemo sets the internal memo.
SetMemo(memo string) MediaInterface
// GetMetas returns all metadata as a map.
GetMetas() (map[string]string, error)
// GetMeta returns a specific metadata value by name.
GetMeta(name string) string
// SetMeta sets a single metadata value.
SetMeta(name string, value string) error
// SetMetas replaces all metadata with the provided map.
SetMetas(metas map[string]string) error
// MetasUpsert merges the provided metadata with existing values.
MetasUpsert(metas map[string]string) error
// MetaRemove removes a single metadata entry.
MetaRemove(name string) error
// MetasRemove removes multiple metadata entries.
MetasRemove(names []string) error
// GetSequence returns the display sequence/order.
GetSequence() int
// SetSequence sets the display sequence/order.
SetSequence(sequence int) MediaInterface
// GetSoftDeletedAt returns the soft deletion timestamp.
GetSoftDeletedAt() string
// GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
GetSoftDeletedAtCarbon() *carbon.Carbon
// SetSoftDeletedAt sets the soft deletion timestamp.
SetSoftDeletedAt(softDeletedAt string) MediaInterface
// GetStatus returns the current status.
GetStatus() string
// SetStatus sets the current status.
SetStatus(status string) MediaInterface
// GetTitle returns the media title.
GetTitle() string
// SetTitle sets the media title.
SetTitle(title string) MediaInterface
// GetType returns the media type (image, video, etc).
GetType() string
// SetType sets the media type.
SetType(mediaType string) MediaInterface
// GetURL returns the media file URL.
GetURL() string
// SetURL sets the media file URL.
SetURL(url string) MediaInterface
// GetUpdatedAt returns the last update timestamp.
GetUpdatedAt() string
// GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
GetUpdatedAtCarbon() *carbon.Carbon
// SetUpdatedAt sets the last update timestamp.
SetUpdatedAt(updatedAt string) MediaInterface
// IsActive returns true if status is active.
IsActive() bool
// IsDraft returns true if status is draft.
IsDraft() bool
// IsInactive returns true if status is inactive.
IsInactive() bool
// IsSoftDeleted returns true if the media is soft deleted.
IsSoftDeleted() bool
// IsImage returns true if media type is image.
IsImage() bool
// IsVideo returns true if media type is video.
IsVideo() bool
}
MediaInterface defines the contract for media entities (images, videos, etc). Media files are associated with entities via EntityID, support sequencing for ordering, soft deletion, metadata storage, and type classification.
func NewMedia ¶
func NewMedia() MediaInterface
NewMedia creates a new media entity with default values: - Status: draft - Title: empty - Description: empty - Memo: empty - CreatedAt: current UTC time - UpdatedAt: current UTC time - SoftDeletedAt: max datetime (not deleted) - Metas: empty map
func NewMediaFromExistingData ¶
func NewMediaFromExistingData(data map[string]string) MediaInterface
NewMediaFromExistingData creates a media entity from existing data map. Used when hydrating from database or external sources.
type MediaQueryInterface ¶
type MediaQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) MediaQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) MediaQueryInterface
HasEntityID() bool
EntityID() string
SetEntityID(entityID string) MediaQueryInterface
HasID() bool
ID() string
SetID(id string) MediaQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) MediaQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) MediaQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) MediaQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) MediaQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) MediaQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) MediaQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) MediaQueryInterface
HasTitleLike() bool
TitleLike() string
SetTitleLike(titleLike string) MediaQueryInterface
HasType() bool
Type() string
SetType(mediaType string) MediaQueryInterface
// contains filtered or unexported methods
}
func NewMediaQuery ¶
func NewMediaQuery() MediaQueryInterface
type NewStoreOptions ¶
type NewStoreOptions struct {
CategoryTableName string
DiscountTableName string
MediaTableName string
OrderTableName string
OrderLineItemTableName string
ProductTableName string
DB *sql.DB
DbDriverName string
AutomigrateEnabled bool
DebugEnabled bool
}
NewStoreOptions define the options for creating a new block store
type Order ¶
type Order struct {
dataobject.DataObject
}
Order represents a customer order in the shop store. Orders track customer purchases with status workflow, pricing, quantity management, soft deletion, and metadata storage. Supports various order states from pending to completed.
func (*Order) GetCreatedAt ¶ added in v1.9.0
GetCreatedAt returns the creation timestamp as a string.
func (*Order) GetCreatedAtCarbon ¶ added in v1.9.0
GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
func (*Order) GetCustomerID ¶ added in v1.9.0
GetCustomerID returns the customer ID.
func (*Order) GetMeta ¶ added in v1.9.0
GetMeta returns a specific metadata value by name. Returns empty string if not found.
func (*Order) GetMetas ¶ added in v1.9.0
GetMetas returns all metadata as a map. Returns empty map if no metas stored.
func (*Order) GetPriceFloat ¶ added in v1.9.0
GetPriceFloat returns the price as a float64.
func (*Order) GetQuantity ¶ added in v1.9.0
GetQuantity returns the quantity as a string.
func (*Order) GetQuantityInt ¶ added in v1.9.0
GetQuantityInt returns the quantity as an int64.
func (*Order) GetSoftDeletedAt ¶ added in v1.9.0
GetSoftDeletedAt returns the soft deletion timestamp.
func (*Order) GetSoftDeletedAtCarbon ¶ added in v1.9.0
GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
func (*Order) GetUpdatedAt ¶ added in v1.9.0
GetUpdatedAt returns the last update timestamp.
func (*Order) GetUpdatedAtCarbon ¶ added in v1.9.0
GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
func (*Order) IsAwaitingFulfillment ¶
IsAwaitingFulfillment returns true if order status is awaiting fulfillment.
func (*Order) IsAwaitingPayment ¶
IsAwaitingPayment returns true if order status is awaiting payment.
func (*Order) IsAwaitingPickup ¶
IsAwaitingPickup returns true if order status is awaiting pickup.
func (*Order) IsAwaitingShipment ¶
IsAwaitingShipment returns true if order status is awaiting shipment.
func (*Order) IsCancelled ¶
IsCancelled returns true if order status is cancelled.
func (*Order) IsCompleted ¶
IsCompleted returns true if order status is completed.
func (*Order) IsDeclined ¶
IsDeclined returns true if order status is declined.
func (*Order) IsDisputed ¶
IsDisputed returns true if order status is disputed.
func (*Order) IsManualVerificationRequired ¶
IsManualVerificationRequired returns true if order requires manual verification.
func (*Order) IsRefunded ¶
IsRefunded returns true if order status is refunded.
func (*Order) MetaRemove ¶ added in v1.9.0
MetaRemove removes a single metadata entry.
func (*Order) MetasRemove ¶ added in v1.9.0
MetasRemove removes multiple metadata entries.
func (*Order) MetasUpsert ¶ added in v1.9.0
MetasUpsert merges the provided metadata with existing values.
func (*Order) SetCreatedAt ¶
func (order *Order) SetCreatedAt(createdAt string) OrderInterface
SetCreatedAt sets the creation timestamp.
func (*Order) SetCustomerID ¶
func (order *Order) SetCustomerID(id string) OrderInterface
SetCustomerID sets the customer ID.
func (*Order) SetID ¶
func (order *Order) SetID(id string) OrderInterface
SetID sets the unique identifier.
func (*Order) SetMemo ¶
func (order *Order) SetMemo(memo string) OrderInterface
SetMemo sets the internal memo.
func (*Order) SetMetas ¶
SetMetas replaces all metadata with the provided map. Warning: this overwrites any existing metadata.
func (*Order) SetPrice ¶
func (order *Order) SetPrice(price string) OrderInterface
SetPrice sets the price from a string.
func (*Order) SetPriceFloat ¶
func (order *Order) SetPriceFloat(price float64) OrderInterface
SetPriceFloat sets the price from a float64.
func (*Order) SetQuantity ¶
func (order *Order) SetQuantity(quantity string) OrderInterface
SetQuantity sets the quantity from a string.
func (*Order) SetQuantityInt ¶
func (order *Order) SetQuantityInt(quantity int64) OrderInterface
SetQuantityInt sets the quantity from an int64.
func (*Order) SetSoftDeletedAt ¶
func (order *Order) SetSoftDeletedAt(deletedAt string) OrderInterface
SetSoftDeletedAt sets the soft deletion timestamp.
func (*Order) SetStatus ¶
func (order *Order) SetStatus(status string) OrderInterface
SetStatus sets the current status.
func (*Order) SetUpdatedAt ¶
func (order *Order) SetUpdatedAt(updatedAt string) OrderInterface
SetUpdatedAt sets the last update timestamp.
type OrderInterface ¶
type OrderInterface interface {
// Data returns a map of all field values for serialization.
Data() map[string]string
// DataChanged returns a map of only the fields that have been modified since load.
DataChanged() map[string]string
// MarkAsNotDirty resets the dirty state, clearing all change tracking.
MarkAsNotDirty()
// IsAwaitingFulfillment returns true if order is awaiting fulfillment.
IsAwaitingFulfillment() bool
// IsAwaitingPayment returns true if order is awaiting payment.
IsAwaitingPayment() bool
// IsAwaitingPickup returns true if order is awaiting pickup.
IsAwaitingPickup() bool
// IsAwaitingShipment returns true if order is awaiting shipment.
IsAwaitingShipment() bool
// IsCancelled returns true if order is cancelled.
IsCancelled() bool
// IsCompleted returns true if order is completed.
IsCompleted() bool
// IsDeclined returns true if order is declined.
IsDeclined() bool
// IsDisputed returns true if order is disputed.
IsDisputed() bool
// IsManualVerificationRequired returns true if order requires manual verification.
IsManualVerificationRequired() bool
// IsPending returns true if order is pending.
IsPending() bool
// IsRefunded returns true if order is refunded.
IsRefunded() bool
// IsShipped returns true if order is shipped.
IsShipped() bool
// GetCreatedAt returns the creation timestamp as a string.
GetCreatedAt() string
// GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
GetCreatedAtCarbon() *carbon.Carbon
// SetCreatedAt sets the creation timestamp.
SetCreatedAt(createdAt string) OrderInterface
// GetCustomerID returns the customer ID.
GetCustomerID() string
// SetCustomerID sets the customer ID.
SetCustomerID(customerID string) OrderInterface
// GetID returns the unique identifier.
GetID() string
// SetID sets the unique identifier.
SetID(id string) OrderInterface
// GetMemo returns the internal memo.
GetMemo() string
// SetMemo sets the internal memo.
SetMemo(memo string) OrderInterface
// GetMeta returns a specific metadata value by name.
GetMeta(name string) string
// SetMeta sets a single metadata value.
SetMeta(name string, value string) error
// GetMetas returns all metadata as a map.
GetMetas() (map[string]string, error)
// SetMetas replaces all metadata with the provided map.
SetMetas(metas map[string]string) error
// MetasUpsert merges the provided metadata with existing values.
MetasUpsert(metas map[string]string) error
// MetaRemove removes a single metadata entry.
MetaRemove(name string) error
// MetasRemove removes multiple metadata entries.
MetasRemove(names []string) error
// GetPrice returns the price as a string.
GetPrice() string
// SetPrice sets the price from a string.
SetPrice(price string) OrderInterface
// GetPriceFloat returns the price as a float64.
GetPriceFloat() float64
// SetPriceFloat sets the price from a float64.
SetPriceFloat(price float64) OrderInterface
// GetQuantity returns the quantity as a string.
GetQuantity() string
// SetQuantity sets the quantity from a string.
SetQuantity(quantity string) OrderInterface
// GetQuantityInt returns the quantity as an int64.
GetQuantityInt() int64
// SetQuantityInt sets the quantity from an int64.
SetQuantityInt(quantity int64) OrderInterface
// GetSoftDeletedAt returns the soft deletion timestamp.
GetSoftDeletedAt() string
// GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
GetSoftDeletedAtCarbon() *carbon.Carbon
// SetSoftDeletedAt sets the soft deletion timestamp.
SetSoftDeletedAt(deletedAt string) OrderInterface
// GetStatus returns the current status.
GetStatus() string
// SetStatus sets the current status.
SetStatus(status string) OrderInterface
// GetUpdatedAt returns the last update timestamp.
GetUpdatedAt() string
// GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
GetUpdatedAtCarbon() *carbon.Carbon
// SetUpdatedAt sets the last update timestamp.
SetUpdatedAt(updatedAt string) OrderInterface
}
OrderInterface defines the contract for order entities. Orders track customer purchases with status workflow, pricing, quantity management, soft deletion, and metadata storage. Supports various order states from pending to completed.
func NewOrder ¶
func NewOrder() OrderInterface
NewOrder creates a new order with default values: - Status: pending - Quantity: 1 - Price: 0.00 (free) - Memo: empty - CreatedAt: current UTC time - UpdatedAt: current UTC time - SoftDeletedAt: max datetime (not deleted) - Metas: empty map
func NewOrderFromExistingData ¶
func NewOrderFromExistingData(data map[string]string) OrderInterface
NewOrderFromExistingData creates an order from existing data map. Used when hydrating from database or external sources.
type OrderLineItem ¶
type OrderLineItem struct {
dataobject.DataObject
}
OrderLineItem represents an individual product within an order. Line items track their own pricing, quantity, product association, and status. Supports soft deletion and metadata storage.
func (*OrderLineItem) GetCreatedAt ¶ added in v1.9.0
func (o *OrderLineItem) GetCreatedAt() string
GetCreatedAt returns the creation timestamp as a string.
func (*OrderLineItem) GetCreatedAtCarbon ¶ added in v1.9.0
func (o *OrderLineItem) GetCreatedAtCarbon() *carbon.Carbon
GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
func (*OrderLineItem) GetID ¶ added in v1.9.0
func (o *OrderLineItem) GetID() string
GetID returns the unique identifier.
func (*OrderLineItem) GetMemo ¶ added in v1.9.0
func (o *OrderLineItem) GetMemo() string
GetMemo returns the internal memo.
func (*OrderLineItem) GetMeta ¶ added in v1.9.0
func (o *OrderLineItem) GetMeta(name string) string
GetMeta returns a specific metadata value by name. Returns empty string if not found.
func (*OrderLineItem) GetMetas ¶ added in v1.9.0
func (o *OrderLineItem) GetMetas() (map[string]string, error)
GetMetas returns all metadata as a map. Returns empty map if no metas stored.
func (*OrderLineItem) GetOrderID ¶ added in v1.9.0
func (o *OrderLineItem) GetOrderID() string
GetOrderID returns the associated order ID.
func (*OrderLineItem) GetPrice ¶ added in v1.9.0
func (o *OrderLineItem) GetPrice() string
GetPrice returns the price as a string.
func (*OrderLineItem) GetPriceFloat ¶ added in v1.9.0
func (o *OrderLineItem) GetPriceFloat() float64
GetPriceFloat returns the price as a float64.
func (*OrderLineItem) GetProductID ¶ added in v1.9.0
func (o *OrderLineItem) GetProductID() string
GetProductID returns the associated product ID.
func (*OrderLineItem) GetQuantity ¶ added in v1.9.0
func (o *OrderLineItem) GetQuantity() string
GetQuantity returns the quantity as a string.
func (*OrderLineItem) GetQuantityInt ¶ added in v1.9.0
func (o *OrderLineItem) GetQuantityInt() int64
GetQuantityInt returns the quantity as an int64.
func (*OrderLineItem) GetSoftDeletedAt ¶ added in v1.9.0
func (o *OrderLineItem) GetSoftDeletedAt() string
GetSoftDeletedAt returns the soft deletion timestamp.
func (*OrderLineItem) GetSoftDeletedAtCarbon ¶ added in v1.9.0
func (o *OrderLineItem) GetSoftDeletedAtCarbon() *carbon.Carbon
GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
func (*OrderLineItem) GetStatus ¶ added in v1.9.0
func (o *OrderLineItem) GetStatus() string
GetStatus returns the current status.
func (*OrderLineItem) GetTitle ¶ added in v1.9.0
func (o *OrderLineItem) GetTitle() string
GetTitle returns the line item title.
func (*OrderLineItem) GetUpdatedAt ¶ added in v1.9.0
func (o *OrderLineItem) GetUpdatedAt() string
GetUpdatedAt returns the last update timestamp.
func (*OrderLineItem) GetUpdatedAtCarbon ¶ added in v1.9.0
func (o *OrderLineItem) GetUpdatedAtCarbon() *carbon.Carbon
GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
func (*OrderLineItem) HasQuantity ¶ added in v1.9.0
func (o *OrderLineItem) HasQuantity() bool
HasQuantity returns true if the quantity is greater than 0.
func (*OrderLineItem) IsActive ¶ added in v1.9.0
func (o *OrderLineItem) IsActive() bool
IsActive returns true if the order line item is in an active state.
func (*OrderLineItem) IsCancelled ¶ added in v1.9.0
func (o *OrderLineItem) IsCancelled() bool
IsCancelled returns true if the order line item is cancelled.
func (*OrderLineItem) IsCompleted ¶ added in v1.9.0
func (o *OrderLineItem) IsCompleted() bool
IsCompleted returns true if the order line item is completed.
func (*OrderLineItem) IsDraft ¶ added in v1.9.0
func (o *OrderLineItem) IsDraft() bool
IsDraft returns true if the order line item is in draft/pending state.
func (*OrderLineItem) IsFree ¶ added in v1.9.0
func (o *OrderLineItem) IsFree() bool
IsFree returns true if the price is less than or equal to 0.
func (*OrderLineItem) MetaRemove ¶ added in v1.9.0
func (o *OrderLineItem) MetaRemove(name string) error
MetaRemove removes a single metadata entry.
func (*OrderLineItem) MetasRemove ¶ added in v1.9.0
func (o *OrderLineItem) MetasRemove(names []string) error
MetasRemove removes multiple metadata entries.
func (*OrderLineItem) MetasUpsert ¶ added in v1.9.0
func (o *OrderLineItem) MetasUpsert(metas map[string]string) error
MetasUpsert merges the provided metadata with existing values.
func (*OrderLineItem) SetCreatedAt ¶
func (o *OrderLineItem) SetCreatedAt(createdAt string) OrderLineItemInterface
SetCreatedAt sets the creation timestamp.
func (*OrderLineItem) SetID ¶
func (o *OrderLineItem) SetID(id string) OrderLineItemInterface
SetID sets the unique identifier.
func (*OrderLineItem) SetMemo ¶
func (o *OrderLineItem) SetMemo(memo string) OrderLineItemInterface
SetMemo sets the internal memo.
func (*OrderLineItem) SetMeta ¶
func (o *OrderLineItem) SetMeta(name string, value string) error
SetMeta sets a single metadata value.
func (*OrderLineItem) SetMetas ¶
func (o *OrderLineItem) SetMetas(metas map[string]string) error
SetMetas replaces all metadata with the provided map. Warning: this overwrites any existing metadata.
func (*OrderLineItem) SetOrderID ¶
func (o *OrderLineItem) SetOrderID(orderID string) OrderLineItemInterface
SetOrderID sets the associated order ID.
func (*OrderLineItem) SetPrice ¶
func (o *OrderLineItem) SetPrice(price string) OrderLineItemInterface
SetPrice sets the price from a string.
func (*OrderLineItem) SetPriceFloat ¶
func (o *OrderLineItem) SetPriceFloat(price float64) OrderLineItemInterface
SetPriceFloat sets the price from a float64.
func (*OrderLineItem) SetProductID ¶
func (o *OrderLineItem) SetProductID(productID string) OrderLineItemInterface
SetProductID sets the associated product ID.
func (*OrderLineItem) SetQuantity ¶
func (o *OrderLineItem) SetQuantity(quantity string) OrderLineItemInterface
SetQuantity sets the quantity from a string.
func (*OrderLineItem) SetQuantityInt ¶
func (o *OrderLineItem) SetQuantityInt(quantity int64) OrderLineItemInterface
SetQuantityInt sets the quantity from an int64.
func (*OrderLineItem) SetSoftDeletedAt ¶
func (o *OrderLineItem) SetSoftDeletedAt(deletedAt string) OrderLineItemInterface
SetSoftDeletedAt sets the soft deletion timestamp.
func (*OrderLineItem) SetStatus ¶
func (o *OrderLineItem) SetStatus(status string) OrderLineItemInterface
SetStatus sets the current status.
func (*OrderLineItem) SetTitle ¶
func (o *OrderLineItem) SetTitle(title string) OrderLineItemInterface
SetTitle sets the line item title.
func (*OrderLineItem) SetUpdatedAt ¶
func (o *OrderLineItem) SetUpdatedAt(updatedAt string) OrderLineItemInterface
SetUpdatedAt sets the last update timestamp.
type OrderLineItemInterface ¶
type OrderLineItemInterface interface {
// Data returns a map of all field values for serialization.
Data() map[string]string
// DataChanged returns a map of only the fields that have been modified since load.
DataChanged() map[string]string
// MarkAsNotDirty resets the dirty state, clearing all change tracking.
MarkAsNotDirty()
// GetCreatedAt returns the creation timestamp as a string.
GetCreatedAt() string
// GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
GetCreatedAtCarbon() *carbon.Carbon
// SetCreatedAt sets the creation timestamp.
SetCreatedAt(createdAt string) OrderLineItemInterface
// GetID returns the unique identifier.
GetID() string
// SetID sets the unique identifier.
SetID(id string) OrderLineItemInterface
// GetMemo returns the internal memo.
GetMemo() string
// SetMemo sets the internal memo.
SetMemo(memo string) OrderLineItemInterface
// GetMetas returns all metadata as a map.
GetMetas() (map[string]string, error)
// SetMetas replaces all metadata with the provided map.
SetMetas(metas map[string]string) error
// GetMeta returns a specific metadata value by name.
GetMeta(name string) string
// SetMeta sets a single metadata value.
SetMeta(name string, value string) error
// MetasUpsert merges the provided metadata with existing values.
MetasUpsert(metas map[string]string) error
// MetaRemove removes a single metadata entry.
MetaRemove(name string) error
// MetasRemove removes multiple metadata entries.
MetasRemove(names []string) error
// GetOrderID returns the associated order ID.
GetOrderID() string
// SetOrderID sets the associated order ID.
SetOrderID(orderID string) OrderLineItemInterface
// GetPrice returns the price as a string.
GetPrice() string
// SetPrice sets the price from a string.
SetPrice(price string) OrderLineItemInterface
// GetPriceFloat returns the price as a float64.
GetPriceFloat() float64
// SetPriceFloat sets the price from a float64.
SetPriceFloat(price float64) OrderLineItemInterface
// GetProductID returns the associated product ID.
GetProductID() string
// SetProductID sets the associated product ID.
SetProductID(productID string) OrderLineItemInterface
// GetQuantity returns the quantity as a string.
GetQuantity() string
// SetQuantity sets the quantity from a string.
SetQuantity(quantity string) OrderLineItemInterface
// GetQuantityInt returns the quantity as an int64.
GetQuantityInt() int64
// SetQuantityInt sets the quantity from an int64.
SetQuantityInt(quantity int64) OrderLineItemInterface
// GetSoftDeletedAt returns the soft deletion timestamp.
GetSoftDeletedAt() string
// GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
GetSoftDeletedAtCarbon() *carbon.Carbon
// SetSoftDeletedAt sets the soft deletion timestamp.
SetSoftDeletedAt(deletedAt string) OrderLineItemInterface
// GetStatus returns the current status.
GetStatus() string
// SetStatus sets the current status.
SetStatus(status string) OrderLineItemInterface
// GetTitle returns the line item title.
GetTitle() string
// SetTitle sets the line item title.
SetTitle(title string) OrderLineItemInterface
// GetUpdatedAt returns the last update timestamp.
GetUpdatedAt() string
// GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
GetUpdatedAtCarbon() *carbon.Carbon
// SetUpdatedAt sets the last update timestamp.
SetUpdatedAt(updatedAt string) OrderLineItemInterface
// IsActive returns true if status is active.
IsActive() bool
// IsCancelled returns true if status is cancelled.
IsCancelled() bool
// IsCompleted returns true if status is completed.
IsCompleted() bool
// IsDraft returns true if status is draft.
IsDraft() bool
// HasQuantity returns true if quantity is greater than zero.
HasQuantity() bool
// IsFree returns true if price is zero.
IsFree() bool
}
OrderLineItemInterface defines the contract for order line item entities. Line items represent individual products within an order with their own pricing, quantity, and status tracking. Supports soft deletion and metadata storage.
func NewOrderLineItem ¶
func NewOrderLineItem() OrderLineItemInterface
NewOrderLineItem creates a new order line item with default values: - Status: pending - Title: empty - Quantity: 1 - Price: 0.00 (free) - Memo: empty - CreatedAt: current UTC time - UpdatedAt: current UTC time - SoftDeletedAt: max datetime (not deleted) - Metas: empty map
func NewOrderLineItemFromExistingData ¶
func NewOrderLineItemFromExistingData(data map[string]string) OrderLineItemInterface
NewOrderLineItemFromExistingData creates an order line item from existing data map. Used when hydrating from database or external sources.
type OrderLineItemQueryInterface ¶
type OrderLineItemQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) OrderLineItemQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) OrderLineItemQueryInterface
HasCreatedAtGte() bool
CreatedAtGte() string
SetCreatedAtGte(createdAtGte string) OrderLineItemQueryInterface
HasCreatedAtLte() bool
CreatedAtLte() string
SetCreatedAtLte(createdAtLte string) OrderLineItemQueryInterface
HasID() bool
ID() string
SetID(id string) OrderLineItemQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) OrderLineItemQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) OrderLineItemQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) OrderLineItemQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) OrderLineItemQueryInterface
HasOrderID() bool
OrderID() string
SetOrderID(orderID string) OrderLineItemQueryInterface
HasOrderIDIn() bool
OrderIDIn() []string
SetOrderIDIn(orderIDIn []string) OrderLineItemQueryInterface
HasProductID() bool
ProductID() string
SetProductID(productID string) OrderLineItemQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) OrderLineItemQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) OrderLineItemQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) OrderLineItemQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) OrderLineItemQueryInterface
// contains filtered or unexported methods
}
func NewOrderLineItemQuery ¶
func NewOrderLineItemQuery() OrderLineItemQueryInterface
type OrderQueryInterface ¶
type OrderQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) OrderQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) OrderQueryInterface
HasCreatedAtGte() bool
CreatedAtGte() string
SetCreatedAtGte(createdAtGte string) OrderQueryInterface
HasCreatedAtLte() bool
CreatedAtLte() string
SetCreatedAtLte(createdAtLte string) OrderQueryInterface
HasCustomerID() bool
CustomerID() string
SetCustomerID(customerID string) OrderQueryInterface
HasID() bool
ID() string
SetID(id string) OrderQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) OrderQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) OrderQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) OrderQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) OrderQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) OrderQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) OrderQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) OrderQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) OrderQueryInterface
// contains filtered or unexported methods
}
func NewOrderQuery ¶
func NewOrderQuery() OrderQueryInterface
type Product ¶
type Product struct {
dataobject.DataObject
}
Product represents a product in the shop store. Products support parent-child relationships (variants), pricing, stock management, variant matrix configuration, soft deletion, metadata storage, and status management.
func (*Product) GetCreatedAt ¶ added in v1.9.0
GetCreatedAt returns the creation timestamp as a string.
func (*Product) GetCreatedAtCarbon ¶ added in v1.9.0
GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
func (*Product) GetDescription ¶ added in v1.9.0
GetDescription returns the full product description.
func (*Product) GetMeta ¶ added in v1.9.0
GetMeta returns a specific metadata value by name. Returns empty string if not found.
func (*Product) GetMetas ¶ added in v1.9.0
GetMetas returns all metadata as a map. Returns empty map if no metas stored.
func (*Product) GetParentID ¶ added in v1.10.0
GetParentID returns the parent product ID (empty if not a variant).
func (*Product) GetPriceFloat ¶ added in v1.9.0
GetPriceFloat returns the price as a float64.
func (*Product) GetQuantity ¶ added in v1.9.0
GetQuantity returns the stock quantity as a string.
func (*Product) GetQuantityInt ¶ added in v1.9.0
GetQuantityInt returns the stock quantity as an int64.
func (*Product) GetShortDescription ¶ added in v1.9.0
GetShortDescription returns the short/abbreviated description.
func (*Product) GetSoftDeletedAt ¶ added in v1.9.0
GetSoftDeletedAt returns the soft deletion timestamp.
func (*Product) GetSoftDeletedAtCarbon ¶ added in v1.9.0
GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
func (*Product) GetUpdatedAt ¶ added in v1.9.0
GetUpdatedAt returns the last update timestamp.
func (*Product) GetUpdatedAtCarbon ¶ added in v1.9.0
GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
func (*Product) GetVariantMatrixSchema ¶ added in v1.10.0
func (product *Product) GetVariantMatrixSchema() (VariantMatrixSchema, error)
GetVariantMatrixSchema returns the variant matrix schema configuration.
func (*Product) GetVariantMatrixValues ¶ added in v1.10.0
GetVariantMatrixValues returns the variant attribute values for this product.
func (*Product) HasStock ¶ added in v1.9.0
HasStock returns true if the product quantity is greater than 0.
func (*Product) HasVariantMatrixSchema ¶ added in v1.10.0
HasVariantMatrixSchema returns true if a variant matrix schema is defined.
func (*Product) IsDisabled ¶
IsDisabled returns true if the product status is disabled.
func (*Product) IsOutOfStock ¶ added in v1.9.0
IsOutOfStock returns true if the product quantity is less than or equal to 0.
func (*Product) IsPaid ¶ added in v1.9.0
IsPaid returns true if the product price is greater than 0.
func (*Product) IsParent ¶ added in v1.10.0
IsParent returns true if this product has variants (has variant matrix schema).
func (*Product) IsSoftDeleted ¶
IsSoftDeleted returns true if the product is soft deleted.
func (*Product) IsVariant ¶ added in v1.10.0
IsVariant returns true if this product is a variant of another product.
func (*Product) MetaRemove ¶ added in v1.9.0
MetaRemove removes a single metadata entry.
func (*Product) MetasRemove ¶ added in v1.9.0
MetasRemove removes multiple metadata entries.
func (*Product) MetasUpsert ¶ added in v1.9.0
MetasUpsert merges the provided metadata with existing values.
func (*Product) SetCreatedAt ¶
func (product *Product) SetCreatedAt(createdAt string) ProductInterface
SetCreatedAt sets the creation timestamp.
func (*Product) SetDescription ¶
func (product *Product) SetDescription(description string) ProductInterface
SetDescription sets the full product description.
func (*Product) SetID ¶
func (product *Product) SetID(id string) ProductInterface
SetID sets the unique identifier.
func (*Product) SetMemo ¶
func (product *Product) SetMemo(memo string) ProductInterface
SetMemo sets the internal memo.
func (*Product) SetMetas ¶
SetMetas replaces all metadata with the provided map. Warning: this overwrites any existing metadata.
func (*Product) SetParentID ¶ added in v1.10.0
func (product *Product) SetParentID(parentID string) ProductInterface
SetParentID sets the parent product ID.
func (*Product) SetPrice ¶
func (product *Product) SetPrice(price string) ProductInterface
SetPrice sets the price from a string.
func (*Product) SetPriceFloat ¶
func (product *Product) SetPriceFloat(price float64) ProductInterface
SetPriceFloat sets the price from a float64.
func (*Product) SetQuantity ¶
func (product *Product) SetQuantity(quantity string) ProductInterface
SetQuantity sets the stock quantity from a string.
func (*Product) SetQuantityInt ¶
func (product *Product) SetQuantityInt(quantity int64) ProductInterface
SetQuantityInt sets the stock quantity from an int64.
func (*Product) SetShortDescription ¶
func (product *Product) SetShortDescription(shortDescription string) ProductInterface
SetShortDescription sets the short/abbreviated description.
func (*Product) SetSoftDeletedAt ¶
func (product *Product) SetSoftDeletedAt(deletedAt string) ProductInterface
SetSoftDeletedAt sets the soft deletion timestamp.
func (*Product) SetStatus ¶
func (product *Product) SetStatus(status string) ProductInterface
SetStatus sets the current status.
func (*Product) SetTitle ¶
func (product *Product) SetTitle(title string) ProductInterface
SetTitle sets the product title.
func (*Product) SetUpdatedAt ¶
func (product *Product) SetUpdatedAt(updatedAt string) ProductInterface
SetUpdatedAt sets the last update timestamp.
func (*Product) SetVariantMatrixSchema ¶ added in v1.10.0
func (product *Product) SetVariantMatrixSchema(schema VariantMatrixSchema) error
SetVariantMatrixSchema sets the variant matrix schema configuration.
func (*Product) SetVariantMatrixValues ¶ added in v1.10.0
SetVariantMatrixValues sets the variant attribute values for this product.
type ProductInterface ¶
type ProductInterface interface {
// Data returns a map of all field values for serialization.
Data() map[string]string
// DataChanged returns a map of only the fields that have been modified since load.
DataChanged() map[string]string
// MarkAsNotDirty resets the dirty state, clearing all change tracking.
MarkAsNotDirty()
// IsActive returns true if status is active.
IsActive() bool
// IsDisabled returns true if status is disabled.
IsDisabled() bool
// IsDraft returns true if status is draft.
IsDraft() bool
// IsParent returns true if this product has variants (has variant matrix schema).
IsParent() bool
// IsSoftDeleted returns true if the product is soft deleted.
IsSoftDeleted() bool
// IsFree returns true if price is zero.
IsFree() bool
// IsVariant returns true if this product is a variant of another product.
IsVariant() bool
// Slug returns the URL-friendly slug for the product.
Slug() string
// HasStock returns true if quantity is greater than zero.
HasStock() bool
// IsOutOfStock returns true if quantity is zero.
IsOutOfStock() bool
// IsPaid returns true if price is greater than zero.
IsPaid() bool
// GetCreatedAt returns the creation timestamp as a string.
GetCreatedAt() string
// GetCreatedAtCarbon returns the creation timestamp as a Carbon instance.
GetCreatedAtCarbon() *carbon.Carbon
// SetCreatedAt sets the creation timestamp.
SetCreatedAt(createdAt string) ProductInterface
// GetDescription returns the full product description.
GetDescription() string
// SetDescription sets the full product description.
SetDescription(description string) ProductInterface
// GetID returns the unique identifier.
GetID() string
// SetID sets the unique identifier.
SetID(id string) ProductInterface
// GetMemo returns the internal memo.
GetMemo() string
// SetMemo sets the internal memo.
SetMemo(memo string) ProductInterface
// GetMeta returns a specific metadata value by name.
GetMeta(name string) string
// SetMeta sets a single metadata value.
SetMeta(name string, value string) error
// GetMetas returns all metadata as a map.
GetMetas() (map[string]string, error)
// SetMetas replaces all metadata with the provided map.
SetMetas(metas map[string]string) error
// MetasUpsert merges the provided metadata with existing values.
MetasUpsert(metas map[string]string) error
// MetaRemove removes a single metadata entry.
MetaRemove(name string) error
// MetasRemove removes multiple metadata entries.
MetasRemove(names []string) error
// GetParentID returns the parent product ID (empty if not a variant).
GetParentID() string
// SetParentID sets the parent product ID.
SetParentID(parentID string) ProductInterface
// GetPrice returns the price as a string.
GetPrice() string
// SetPrice sets the price from a string.
SetPrice(price string) ProductInterface
// GetPriceFloat returns the price as a float64.
GetPriceFloat() float64
// SetPriceFloat sets the price from a float64.
SetPriceFloat(price float64) ProductInterface
// GetQuantity returns the stock quantity as a string.
GetQuantity() string
// SetQuantity sets the stock quantity from a string.
SetQuantity(quantity string) ProductInterface
// GetQuantityInt returns the stock quantity as an int64.
GetQuantityInt() int64
// SetQuantityInt sets the stock quantity from an int64.
SetQuantityInt(quantity int64) ProductInterface
// GetSoftDeletedAt returns the soft deletion timestamp.
GetSoftDeletedAt() string
// GetSoftDeletedAtCarbon returns the soft deletion timestamp as a Carbon instance.
GetSoftDeletedAtCarbon() *carbon.Carbon
// SetSoftDeletedAt sets the soft deletion timestamp.
SetSoftDeletedAt(deletedAt string) ProductInterface
// GetShortDescription returns the short/abbreviated description.
GetShortDescription() string
// SetShortDescription sets the short/abbreviated description.
SetShortDescription(shortDescription string) ProductInterface
// GetStatus returns the current status.
GetStatus() string
// SetStatus sets the current status.
SetStatus(status string) ProductInterface
// GetTitle returns the product title.
GetTitle() string
// SetTitle sets the product title.
SetTitle(title string) ProductInterface
// GetUpdatedAt returns the last update timestamp.
GetUpdatedAt() string
// GetUpdatedAtCarbon returns the last update timestamp as a Carbon instance.
GetUpdatedAtCarbon() *carbon.Carbon
// SetUpdatedAt sets the last update timestamp.
SetUpdatedAt(updatedAt string) ProductInterface
// GetVariantMatrixSchema returns the variant matrix schema configuration.
GetVariantMatrixSchema() (VariantMatrixSchema, error)
// SetVariantMatrixSchema sets the variant matrix schema configuration.
SetVariantMatrixSchema(schema VariantMatrixSchema) error
// HasVariantMatrixSchema returns true if a variant matrix schema is defined.
HasVariantMatrixSchema() bool
// GetVariantMatrixValues returns the variant attribute values for this product.
GetVariantMatrixValues() (map[string]string, error)
// SetVariantMatrixValues sets the variant attribute values for this product.
SetVariantMatrixValues(values map[string]string) error
}
ProductInterface defines the contract for product entities. Products support parent-child relationships (variants), pricing, stock management, variant matrix configuration, soft deletion, metadata storage, and status management.
func NewProduct ¶
func NewProduct() ProductInterface
NewProduct creates a new product with default values: - Status: draft - Title: empty - Description: empty - ShortDescription: empty - Quantity: 0 - Price: 0.00 (free) - ParentID: empty (not a variant) - Memo: empty - CreatedAt: current UTC time - UpdatedAt: current UTC time - SoftDeletedAt: max datetime (not deleted) - Metas: empty map - VariantMatrixSchema: empty - VariantMatrixValues: empty map
func NewProductFromExistingData ¶
func NewProductFromExistingData(data map[string]string) ProductInterface
NewProductFromExistingData creates a product from existing data map. Used when hydrating from database or external sources.
type ProductQueryInterface ¶
type ProductQueryInterface interface {
Validate() error
Columns() []string
SetColumns(columns []string) ProductQueryInterface
HasCountOnly() bool
IsCountOnly() bool
SetCountOnly(countOnly bool) ProductQueryInterface
HasCreatedAtGte() bool
CreatedAtGte() string
SetCreatedAtGte(createdAtGte string) ProductQueryInterface
HasCreatedAtLte() bool
CreatedAtLte() string
SetCreatedAtLte(createdAtLte string) ProductQueryInterface
HasID() bool
ID() string
SetID(id string) ProductQueryInterface
HasIDIn() bool
IDIn() []string
SetIDIn(idIn []string) ProductQueryInterface
HasLimit() bool
Limit() int
SetLimit(limit int) ProductQueryInterface
HasOffset() bool
Offset() int
SetOffset(offset int) ProductQueryInterface
HasOrderBy() bool
OrderBy() string
SetOrderBy(orderBy string) ProductQueryInterface
HasSortDirection() bool
SortDirection() string
SetSortDirection(sortDirection string) ProductQueryInterface
HasSoftDeletedIncluded() bool
SoftDeletedIncluded() bool
SetSoftDeletedIncluded(softDeletedIncluded bool) ProductQueryInterface
HasStatus() bool
Status() string
SetStatus(status string) ProductQueryInterface
HasStatusIn() bool
StatusIn() []string
SetStatusIn(statusIn []string) ProductQueryInterface
HasTitleLike() bool
TitleLike() string
SetTitleLike(titleLike string) ProductQueryInterface
HasParentID() bool
ParentID() string
SetParentID(parentID string) ProductQueryInterface
// contains filtered or unexported methods
}
func NewProductQuery ¶
func NewProductQuery() ProductQueryInterface
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func NewStore ¶
func NewStore(opts NewStoreOptions) (*Store, error)
NewStore creates a new block store
func (*Store) CategoryCount ¶
func (*Store) CategoryCreate ¶
func (store *Store) CategoryCreate(ctx context.Context, category CategoryInterface) error
func (*Store) CategoryDelete ¶
func (store *Store) CategoryDelete(ctx context.Context, category CategoryInterface) error
func (*Store) CategoryDeleteByID ¶
func (*Store) CategoryFindByID ¶
func (*Store) CategoryList ¶
func (store *Store) CategoryList(ctx context.Context, options CategoryQueryInterface) ([]CategoryInterface, error)
func (*Store) CategorySoftDelete ¶
func (store *Store) CategorySoftDelete(ctx context.Context, category CategoryInterface) error
func (*Store) CategorySoftDeleteByID ¶
func (*Store) CategoryTableName ¶
func (*Store) CategoryUpdate ¶
func (store *Store) CategoryUpdate(ctx context.Context, category CategoryInterface) (err error)
func (*Store) DiscountCount ¶
func (*Store) DiscountCreate ¶
func (store *Store) DiscountCreate(ctx context.Context, discount DiscountInterface) error
func (*Store) DiscountDelete ¶
func (store *Store) DiscountDelete(ctx context.Context, discount DiscountInterface) error
func (*Store) DiscountDeleteByID ¶
func (*Store) DiscountFindByCode ¶
func (*Store) DiscountFindByID ¶
func (*Store) DiscountList ¶
func (store *Store) DiscountList(ctx context.Context, options DiscountQueryInterface) ([]DiscountInterface, error)
func (*Store) DiscountSoftDelete ¶
func (store *Store) DiscountSoftDelete(ctx context.Context, discount DiscountInterface) error
func (*Store) DiscountSoftDeleteByID ¶
func (*Store) DiscountTableName ¶
func (*Store) DiscountUpdate ¶
func (store *Store) DiscountUpdate(ctx context.Context, discount DiscountInterface) error
func (*Store) EnableDebug ¶
EnableDebug - enables the debug option
func (*Store) MediaCount ¶
func (*Store) MediaCreate ¶
func (store *Store) MediaCreate(ctx context.Context, media MediaInterface) error
func (*Store) MediaDelete ¶
func (store *Store) MediaDelete(ctx context.Context, media MediaInterface) error
func (*Store) MediaDeleteByID ¶
func (*Store) MediaFindByID ¶
func (*Store) MediaList ¶
func (store *Store) MediaList(ctx context.Context, options MediaQueryInterface) ([]MediaInterface, error)
func (*Store) MediaSoftDelete ¶
func (store *Store) MediaSoftDelete(ctx context.Context, media MediaInterface) error
func (*Store) MediaSoftDeleteByID ¶
func (*Store) MediaTableName ¶
func (*Store) MediaUpdate ¶
func (store *Store) MediaUpdate(ctx context.Context, media MediaInterface) (err error)
func (*Store) OrderCount ¶
func (*Store) OrderCreate ¶
func (store *Store) OrderCreate(ctx context.Context, order OrderInterface) error
func (*Store) OrderDelete ¶
func (store *Store) OrderDelete(ctx context.Context, order OrderInterface) error
func (*Store) OrderDeleteByID ¶
func (*Store) OrderFindByID ¶
func (*Store) OrderLineItemCount ¶
func (*Store) OrderLineItemCreate ¶
func (store *Store) OrderLineItemCreate(ctx context.Context, orderLineItem OrderLineItemInterface) error
func (*Store) OrderLineItemDelete ¶
func (store *Store) OrderLineItemDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
func (*Store) OrderLineItemDeleteByID ¶
func (*Store) OrderLineItemFindByID ¶
func (*Store) OrderLineItemList ¶
func (store *Store) OrderLineItemList(ctx context.Context, options OrderLineItemQueryInterface) ([]OrderLineItemInterface, error)
func (*Store) OrderLineItemSoftDelete ¶
func (store *Store) OrderLineItemSoftDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
func (*Store) OrderLineItemSoftDeleteByID ¶
func (*Store) OrderLineItemTableName ¶
func (*Store) OrderLineItemUpdate ¶
func (store *Store) OrderLineItemUpdate(ctx context.Context, orderLineItem OrderLineItemInterface) error
func (*Store) OrderList ¶
func (store *Store) OrderList(ctx context.Context, options OrderQueryInterface) ([]OrderInterface, error)
func (*Store) OrderSoftDelete ¶
func (store *Store) OrderSoftDelete(ctx context.Context, order OrderInterface) error
func (*Store) OrderSoftDeleteByID ¶
func (*Store) OrderTableName ¶
func (*Store) OrderUpdate ¶
func (store *Store) OrderUpdate(ctx context.Context, order OrderInterface) error
func (*Store) ProductCount ¶
func (*Store) ProductCreate ¶
func (store *Store) ProductCreate(ctx context.Context, product ProductInterface) error
func (*Store) ProductDelete ¶
func (store *Store) ProductDelete(ctx context.Context, product ProductInterface) error
func (*Store) ProductDeleteByID ¶
func (*Store) ProductFindByID ¶
func (*Store) ProductGetParent ¶ added in v1.10.0
func (store *Store) ProductGetParent(ctx context.Context, productID string) (ProductInterface, error)
ProductGetParent returns the parent product of a variant
func (*Store) ProductIsParent ¶ added in v1.10.0
ProductIsParent returns true if the product has variants (has variant dimensions defined)
func (*Store) ProductList ¶
func (store *Store) ProductList(ctx context.Context, options ProductQueryInterface) ([]ProductInterface, error)
func (*Store) ProductSoftDelete ¶
func (store *Store) ProductSoftDelete(ctx context.Context, product ProductInterface) error
func (*Store) ProductSoftDeleteByID ¶
func (*Store) ProductTableName ¶
func (*Store) ProductUpdate ¶
func (store *Store) ProductUpdate(ctx context.Context, product ProductInterface) error
func (*Store) ProductVariantList ¶ added in v1.10.0
func (store *Store) ProductVariantList(ctx context.Context, parentID string) ([]ProductInterface, error)
ProductVariantList returns all variants for a given parent product ID
type StoreInterface ¶
type StoreInterface interface {
// AutoMigrate creates or updates database tables to match the current schema.
AutoMigrate() error
// DB returns the underlying SQL database connection.
DB() *sql.DB
// EnableDebug enables or disables debug logging for SQL queries.
EnableDebug(debug bool, sqlLogger ...*slog.Logger)
// CategoryTableName returns the database table name for categories.
CategoryTableName() string
// DiscountTableName returns the database table name for discounts.
DiscountTableName() string
// MediaTableName returns the database table name for media.
MediaTableName() string
// OrderTableName returns the database table name for orders.
OrderTableName() string
// OrderLineItemTableName returns the database table name for order line items.
OrderLineItemTableName() string
// ProductTableName returns the database table name for products.
ProductTableName() string
// CategoryCount returns the total count of categories matching the query options.
CategoryCount(ctx context.Context, options CategoryQueryInterface) (int64, error)
// CategoryCreate inserts a new category into the database.
CategoryCreate(context context.Context, category CategoryInterface) error
// CategoryDelete permanently deletes a category from the database.
CategoryDelete(context context.Context, category CategoryInterface) error
// CategoryDeleteByID permanently deletes a category by its ID.
CategoryDeleteByID(context context.Context, categoryID string) error
// CategoryFindByID retrieves a category by its unique ID.
CategoryFindByID(context context.Context, categoryID string) (CategoryInterface, error)
// CategoryList retrieves a list of categories matching the query options.
CategoryList(context context.Context, options CategoryQueryInterface) ([]CategoryInterface, error)
// CategorySoftDelete soft deletes a category by setting the deleted timestamp.
CategorySoftDelete(context context.Context, category CategoryInterface) error
// CategorySoftDeleteByID soft deletes a category by its ID.
CategorySoftDeleteByID(context context.Context, categoryID string) error
// CategoryUpdate updates an existing category in the database.
CategoryUpdate(contxt context.Context, category CategoryInterface) error
// DiscountCount returns the total count of discounts matching the query options.
DiscountCount(ctx context.Context, options DiscountQueryInterface) (int64, error)
// DiscountCreate inserts a new discount into the database.
DiscountCreate(ctx context.Context, discount DiscountInterface) error
// DiscountDelete permanently deletes a discount from the database.
DiscountDelete(ctx context.Context, discount DiscountInterface) error
// DiscountDeleteByID permanently deletes a discount by its ID.
DiscountDeleteByID(ctx context.Context, discountID string) error
// DiscountFindByID retrieves a discount by its unique ID.
DiscountFindByID(ctx context.Context, discountID string) (DiscountInterface, error)
// DiscountFindByCode retrieves a discount by its unique code.
DiscountFindByCode(ctx context.Context, code string) (DiscountInterface, error)
// DiscountList retrieves a list of discounts matching the query options.
DiscountList(ctx context.Context, options DiscountQueryInterface) ([]DiscountInterface, error)
// DiscountSoftDelete soft deletes a discount by setting the deleted timestamp.
DiscountSoftDelete(ctx context.Context, discount DiscountInterface) error
// DiscountSoftDeleteByID soft deletes a discount by its ID.
DiscountSoftDeleteByID(ctx context.Context, discountID string) error
// DiscountUpdate updates an existing discount in the database.
DiscountUpdate(ctx context.Context, discount DiscountInterface) error
// MediaCount returns the total count of media matching the query options.
MediaCount(ctx context.Context, options MediaQueryInterface) (int64, error)
// MediaCreate inserts a new media into the database.
MediaCreate(ctx context.Context, media MediaInterface) error
// MediaDelete permanently deletes a media from the database.
MediaDelete(ctx context.Context, media MediaInterface) error
// MediaDeleteByID permanently deletes a media by its ID.
MediaDeleteByID(ctx context.Context, mediaID string) error
// MediaFindByID retrieves a media by its unique ID.
MediaFindByID(ctx context.Context, mediaID string) (MediaInterface, error)
// MediaList retrieves a list of media matching the query options.
MediaList(ctx context.Context, options MediaQueryInterface) ([]MediaInterface, error)
// MediaSoftDelete soft deletes a media by setting the deleted timestamp.
MediaSoftDelete(ctx context.Context, media MediaInterface) error
// MediaSoftDeleteByID soft deletes a media by its ID.
MediaSoftDeleteByID(ctx context.Context, mediaID string) error
// MediaUpdate updates an existing media in the database.
MediaUpdate(ctx context.Context, media MediaInterface) error
// OrderCount returns the total count of orders matching the query options.
OrderCount(ctx context.Context, options OrderQueryInterface) (int64, error)
// OrderCreate inserts a new order into the database.
OrderCreate(ctx context.Context, order OrderInterface) error
// OrderDelete permanently deletes an order from the database.
OrderDelete(ctx context.Context, order OrderInterface) error
// OrderDeleteByID permanently deletes an order by its ID.
OrderDeleteByID(ctx context.Context, id string) error
// OrderFindByID retrieves an order by its unique ID.
OrderFindByID(ctx context.Context, id string) (OrderInterface, error)
// OrderList retrieves a list of orders matching the query options.
OrderList(ctx context.Context, options OrderQueryInterface) ([]OrderInterface, error)
// OrderSoftDelete soft deletes an order by setting the deleted timestamp.
OrderSoftDelete(ctx context.Context, order OrderInterface) error
// OrderSoftDeleteByID soft deletes an order by its ID.
OrderSoftDeleteByID(ctx context.Context, id string) error
// OrderUpdate updates an existing order in the database.
OrderUpdate(ctx context.Context, order OrderInterface) error
// OrderLineItemCount returns the total count of line items matching the query options.
OrderLineItemCount(ctx context.Context, options OrderLineItemQueryInterface) (int64, error)
// OrderLineItemCreate inserts a new line item into the database.
OrderLineItemCreate(ctx context.Context, orderLineItem OrderLineItemInterface) error
// OrderLineItemDelete permanently deletes a line item from the database.
OrderLineItemDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
// OrderLineItemDeleteByID permanently deletes a line item by its ID.
OrderLineItemDeleteByID(ctx context.Context, id string) error
// OrderLineItemFindByID retrieves a line item by its unique ID.
OrderLineItemFindByID(ctx context.Context, id string) (OrderLineItemInterface, error)
// OrderLineItemList retrieves a list of line items matching the query options.
OrderLineItemList(ctx context.Context, options OrderLineItemQueryInterface) ([]OrderLineItemInterface, error)
// OrderLineItemSoftDelete soft deletes a line item by setting the deleted timestamp.
OrderLineItemSoftDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
// OrderLineItemSoftDeleteByID soft deletes a line item by its ID.
OrderLineItemSoftDeleteByID(ctx context.Context, id string) error
// OrderLineItemUpdate updates an existing line item in the database.
OrderLineItemUpdate(ctx context.Context, orderLineItem OrderLineItemInterface) error
// ProductCount returns the total count of products matching the query options.
ProductCount(ctx context.Context, options ProductQueryInterface) (int64, error)
// ProductCreate inserts a new product into the database.
ProductCreate(ctx context.Context, product ProductInterface) error
// ProductDelete permanently deletes a product from the database.
ProductDelete(ctx context.Context, product ProductInterface) error
// ProductDeleteByID permanently deletes a product by its ID.
ProductDeleteByID(ctx context.Context, productID string) error
// ProductFindByID retrieves a product by its unique ID.
ProductFindByID(ctx context.Context, productID string) (ProductInterface, error)
// ProductList retrieves a list of products matching the query options.
ProductList(ctx context.Context, options ProductQueryInterface) ([]ProductInterface, error)
// ProductSoftDelete soft deletes a product by setting the deleted timestamp.
ProductSoftDelete(ctx context.Context, product ProductInterface) error
// ProductSoftDeleteByID soft deletes a product by its ID.
ProductSoftDeleteByID(ctx context.Context, productID string) error
// ProductUpdate updates an existing product in the database.
ProductUpdate(ctx context.Context, product ProductInterface) error
// ProductVariantList retrieves all variants for a parent product.
ProductVariantList(ctx context.Context, parentID string) ([]ProductInterface, error)
// ProductIsParent checks if a product is a parent (has variants).
ProductIsParent(ctx context.Context, productID string) (bool, error)
// ProductGetParent retrieves the parent product for a variant.
ProductGetParent(ctx context.Context, productID string) (ProductInterface, error)
}
StoreInterface defines the contract for the shop store database operations. Provides CRUD operations, soft deletion, counting, listing with pagination, and variant management for all entity types (categories, discounts, media, orders, products).
type VariantMatrixSchema ¶ added in v1.10.0
type VariantMatrixSchema struct {
Name string `json:"name"` // "color", "size"
Required bool `json:"required"` // must variant have this?
Options []string `json:"options,omitempty"` // allowed values (optional)
}
VariantMatrixSchema defines a single dimension for product variants. Used to define variant attributes like color, size, material, etc. Supports optional predefined options and required/optional flags.
Source Files
¶
- Store.go
- consts.go
- id_helpers.go
- interfaces.go
- query_category.go
- query_discount.go
- query_media.go
- query_order.go
- query_order_line_item.go
- query_product.go
- sqls.go
- store_category.go
- store_discount.go
- store_media.go
- store_new.go
- store_order.go
- store_product.go
- type_category.go
- type_discount.go
- type_media.go
- type_order.go
- type_order_line_item.go
- type_product.go