shopstore

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

README

Shop Store Open in Gitpod

Tests Status Go Report Card PkgGoDev

Shop Store is a Go package that provides a database-backed store for common commerce entities such as products, orders, discounts, media, and categories. It builds on the dataobject pattern to give you rich domain objects with change tracking, metadata handling, soft deletion, and query builders out of the box.

Table of contents

  1. Features
  2. Installation
  3. Quick start
  4. Domain entities
  5. Query builders
  6. Metadata & soft deletion
  7. Debugging & observability
  8. Testing
  9. Development
  10. License

Features

  • Composable store – instantiate a Store with your own table names, database connection, and migration settings.
  • Rich domain objectsCategory, Discount, Media, Order, OrderLineItem, and Product types expose defaults, helpers, predicates, and getter/setter chains.
  • Change tracking – entities track dirty fields and ensure updates persist only modified values.
  • Metadata support – uniform metas JSON helpers (SetMetas, UpsertMetas, Meta) across all entities.
  • Soft deletion – soft-delete helpers hide records unless explicitly requested.
  • Query builders – fluent Query helpers for filtering, pagination, sorting, and counting.
  • Auto-migration – optional schema bootstrap via sb builders.
  • Observability – opt-in SQL logging and configurable timeouts.

Installation

The module path is github.com/dracory/shopstore.

go get github.com/dracory/shopstore

Quick start

package main

import (
    "context"
    "database/sql"
    _ "modernc.org/sqlite" // or your preferred driver

    "github.com/dracory/shopstore"
)

func main() {
    db, err := sql.Open("sqlite", "file:shop.db?_pragma=busy_timeout(5000)&cache=shared")
    if err != nil {
        panic(err)
    }

    store, err := shopstore.NewStore(shopstore.NewStoreOptions{
        DB:                     db,
        CategoryTableName:      "shop_category",
        DiscountTableName:      "shop_discount",
        MediaTableName:         "shop_media",
        OrderTableName:         "shop_order",
        OrderLineItemTableName: "shop_order_line_item",
        ProductTableName:       "shop_product",
        AutomigrateEnabled:     true,
        DebugEnabled:           true,
    })
    if err != nil {
        panic(err)
    }

    ctx := context.Background()

    product := shopstore.NewProduct().
        SetTitle("Cascade T-Shirt").
        SetDescription("Premium cotton tee").
        SetQuantityInt(25).
        SetPriceFloat(19.99)

    if err := store.ProductCreate(ctx, product); err != nil {
        panic(err)
    }

    list, err := store.ProductList(ctx, shopstore.NewProductQuery().
        SetStatus(shopstore.PRODUCT_STATUS_ACTIVE).
        SetLimit(10))
    if err != nil {
        panic(err)
    }

    for _, p := range list {
        println(p.ID(), p.Title(), p.PriceFloat())
    }
}

All entity constructors set sensible defaults (IDs, timestamps, status, and empty metadata). For example:

order := shopstore.NewOrder().
    SetCustomerID("customer_123").
    SetStatus(shopstore.ORDER_STATUS_PENDING)

if err := store.OrderCreate(ctx, order); err != nil {
    // handle error
}

Domain entities

Each entity embeds dataobject.DataObject, enabling fluent setters and change tracking. Key helpers include:

Entity Highlights
Product IsActive, IsDraft, slug generation, price/quantity helpers.
Order Rich status predicates (awaiting shipment, refunded, etc.).
OrderLineItem Links products to orders, maintains quantity and price helpers.
Discount Code generator, amount/percent handling, start/end scheduling.
Category Parent/child relationships, active/draft state, meta helpers.
Media Sequence positioning, media type/URL helpers for assets.

Getter and setter methods mirror column names (Title(), SetTitle(string), PriceFloat(), SetPriceFloat(float64), etc.) and accept both string/typed values where appropriate.

Query builders

The New<Category|Discount|Media|Order|OrderLineItem|Product>Query helpers expose fluent filters:

  • SetID, SetIDIn, SetStatus, SetStatusIn for equality filters.
  • SetCreatedAtGte/SetCreatedAtLte for time windows.
  • SetTitleLike for partial matches.
  • SetLimit, SetOffset, SetOrderBy, SetSortDirection for pagination and sorting.
  • SetSoftDeletedIncluded(true) to include soft-deleted rows.
  • SetCountOnly(true) to build count queries.

Queries validate their input (Validate()) so you get fast feedback on missing or invalid parameters before hitting the database.

Metadata & soft deletion

Every entity stores arbitrary key/value pairs in a JSON metas column. Use:

_ = product.SetMetas(map[string]string{"color": "navy"})
_ = product.UpsertMetas(map[string]string{"size": "L"})
size := product.Meta("size")

Soft deletion is handled via the soft_deleted_at column. Standard list operations exclude soft-deleted rows unless SetSoftDeletedIncluded(true) is used. Helpers such as ProductSoftDelete and CategorySoftDelete set the column to the current timestamp.

Debugging & observability

  • Enable SQL logging with store.EnableDebug(true, slogLogger).
  • Customize store behaviour through NewStoreOptions (AutomigrateEnabled, DebugEnabled, DbDriverName, custom timeouts).
  • AutoMigrate() runs table creation statements generated through sb column builders when AutomigrateEnabled is set.

Testing

Comprehensive unit tests cover entity defaults, predicate helpers, metadata operations, and store behaviour. Run them with:

go test ./...

Development

  • Tasks are defined in Taskfile.yml for common workflows.
  • The project targets Go 1.25 (see go.mod) and uses SQLite for integration tests via modernc.org/sqlite.
  • Contributions are welcome—please open an issue or pull request with proposed changes.

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). You can find a copy of the license at https://www.gnu.org/licenses/agpl-3.0.en.html.

For commercial use, please use the contact page to obtain a commercial license.

Documentation

Index

Constants

View Source
const CATEGORY_STATUS_ACTIVE = "active"
View Source
const CATEGORY_STATUS_DRAFT = "draft"
View Source
const CATEGORY_STATUS_INACTIVE = "inactive"
View Source
const COLUMN_AMOUNT = "amount"
View Source
const COLUMN_CODE = "code"
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_CUSTOMER_ID = "customer_id"
View Source
const COLUMN_DESCRIPTION = "description"
View Source
const COLUMN_ENDS_AT = "ends_at"
View Source
const COLUMN_ENTITY_ID = "entity_id"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_MEDIA_TYPE = "media_type"
View Source
const COLUMN_MEDIA_URL = "media_url"
View Source
const COLUMN_MEMO = "memo"
View Source
const COLUMN_METAS = "metas"
View Source
const COLUMN_ORDER_ID = "order_id"
View Source
const COLUMN_PARENT_ID = "parent_id"
View Source
const COLUMN_PRICE = "price"
View Source
const COLUMN_PRODUCT_ID = "product_id"
View Source
const COLUMN_QUANTITY = "quantity"
View Source
const COLUMN_SEQUENCE = "sequence"
View Source
const COLUMN_SHORT_DESCRIPTION = "short_description"
View Source
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
View Source
const COLUMN_STARTS_AT = "starts_at"
View Source
const COLUMN_STATUS = "status"
View Source
const COLUMN_TITLE = "title"
View Source
const COLUMN_TYPE = "type"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const DISCOUNT_DURATION_FOREVER = "forever"
View Source
const DISCOUNT_DURATION_MONTHS = "months"
View Source
const DISCOUNT_DURATION_ONCE = "once"
View Source
const DISCOUNT_STATUS_ACTIVE = "active"
View Source
const DISCOUNT_STATUS_DRAFT = "draft"
View Source
const DISCOUNT_STATUS_INACTIVE = "inactive"
View Source
const DISCOUNT_TYPE_AMOUNT = "amount"
View Source
const DISCOUNT_TYPE_PERCENT = "percent"
View Source
const MEDIA_STATUS_ACTIVE = "active"
View Source
const MEDIA_STATUS_DRAFT = "draft"
View Source
const MEDIA_STATUS_INACTIVE = "inactive"
View Source
const MEDIA_TYPE_IMAGE_JPG = "image/jpeg"
View Source
const MEDIA_TYPE_IMAGE_PNG = "image/png"
View Source
const MEDIA_TYPE_VIDEO_MP4 = "video/mp4"
View Source
const ORDER_STATUS_AWAITING_FULFILLMENT = "awaiting_fulfillment"

Customer has completed the checkout process and payment has been confirmed.

View Source
const ORDER_STATUS_AWAITING_PAYMENT = "awaiting_payment"

Customer has completed the checkout process, but payment has yet to be confirmed.

View Source
const ORDER_STATUS_AWAITING_PICKUP = "awaiting_pickup"

Order has been packaged and is awaiting customer pickup from a seller-specified location.

View Source
const ORDER_STATUS_AWAITING_SHIPMENT = "awaiting_shipment"

Order has been pulled and packaged and is awaiting collection from a shipping provider.

View Source
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.

View Source
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.

View Source
const ORDER_STATUS_DECLINED = "declined"

Seller has marked the order as declined.

View Source
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.

View Source
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.

View Source
const ORDER_STATUS_PARTIALLY_REFUNDED = "partially_refunded"

Seller has partially refunded the order.

View Source
const ORDER_STATUS_PARTIALLY_SHIPPED = "partially_shipped"

Only some items in the order have been shipped.

View Source
const ORDER_STATUS_PENDING = "pending"

Customer started the checkout process but did not complete it.

View Source
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.

View Source
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.

View Source
const PRODUCT_STATUS_ACTIVE = "active"
View Source
const PRODUCT_STATUS_DISABLED = "disabled"
View Source
const PRODUCT_STATUS_DRAFT = "draft"

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	dataobject.DataObject
}

func NewCategoryFromExistingData

func NewCategoryFromExistingData(data map[string]string) *Category

func (*Category) CreatedAt

func (category *Category) CreatedAt() string

func (*Category) CreatedAtCarbon

func (category *Category) CreatedAtCarbon() *carbon.Carbon

func (*Category) CustomerID

func (category *Category) CustomerID() string

func (*Category) Description

func (category *Category) Description() string

func (*Category) ID

func (category *Category) ID() string

func (*Category) IsActive

func (category *Category) IsActive() bool

func (*Category) IsDraft

func (category *Category) IsDraft() bool

func (*Category) IsInactive

func (category *Category) IsInactive() bool

func (*Category) IsSoftDeleted

func (category *Category) IsSoftDeleted() bool

func (*Category) Memo

func (category *Category) Memo() string

func (*Category) Meta

func (category *Category) Meta(name string) string

func (*Category) Metas

func (category *Category) Metas() (map[string]string, error)

func (*Category) ParentID

func (category *Category) ParentID() string

func (*Category) SetCreatedAt

func (category *Category) SetCreatedAt(createdAt string) CategoryInterface

func (*Category) SetCustomerID

func (category *Category) SetCustomerID(id string) CategoryInterface

func (*Category) SetDescription

func (category *Category) SetDescription(description string) CategoryInterface

func (*Category) SetID

func (category *Category) SetID(id string) CategoryInterface

func (*Category) SetMemo

func (category *Category) SetMemo(memo string) CategoryInterface

func (*Category) SetMeta

func (category *Category) SetMeta(name string, value string) error

func (*Category) SetMetas

func (category *Category) SetMetas(metas map[string]string) error

SetMetas stores metas as json string Warning: it overwrites any existing metas

func (*Category) SetParentID

func (category *Category) SetParentID(parentID string) CategoryInterface

func (*Category) SetSoftDeletedAt

func (category *Category) SetSoftDeletedAt(softDeletedAt string) CategoryInterface

func (*Category) SetStatus

func (category *Category) SetStatus(status string) CategoryInterface

func (*Category) SetTitle

func (category *Category) SetTitle(title string) CategoryInterface

func (*Category) SetUpdatedAt

func (category *Category) SetUpdatedAt(updatedAt string) CategoryInterface

func (*Category) SoftDeletedAt

func (category *Category) SoftDeletedAt() string

func (*Category) SoftDeletedAtCarbon

func (category *Category) SoftDeletedAtCarbon() *carbon.Carbon

func (*Category) Status

func (category *Category) Status() string

func (*Category) Title

func (category *Category) Title() string

func (*Category) UpdatedAt

func (category *Category) UpdatedAt() string

func (*Category) UpdatedAtCarbon

func (category *Category) UpdatedAtCarbon() *carbon.Carbon

func (*Category) UpsertMetas

func (category *Category) UpsertMetas(metas map[string]string) error

type CategoryInterface

type CategoryInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) CategoryInterface

	Description() string
	SetDescription(description string) CategoryInterface

	ID() string
	SetID(id string) CategoryInterface

	Memo() string
	SetMemo(memo string) CategoryInterface

	Metas() (map[string]string, error)
	Meta(name string) string
	SetMeta(name string, value string) error
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	ParentID() string
	SetParentID(parentID string) CategoryInterface

	Status() string
	SetStatus(status string) CategoryInterface

	Title() string
	SetTitle(title string) CategoryInterface

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) CategoryInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) CategoryInterface
}

func NewCategory

func NewCategory() CategoryInterface

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
}

func (*Discount) Amount

func (d *Discount) Amount() float64

func (*Discount) Code

func (d *Discount) Code() string

func (*Discount) CreatedAt

func (d *Discount) CreatedAt() string

func (*Discount) CreatedAtCarbon

func (d *Discount) CreatedAtCarbon() *carbon.Carbon

func (*Discount) Description

func (d *Discount) Description() string

func (*Discount) EndsAt

func (d *Discount) EndsAt() string

func (*Discount) EndsAtCarbon

func (d *Discount) EndsAtCarbon() *carbon.Carbon

func (*Discount) ID

func (o *Discount) ID() string

ID returns the ID of the exam

func (*Discount) Memo

func (d *Discount) Memo() string

func (*Discount) Meta

func (d *Discount) Meta(name string) string

func (*Discount) MetaRemove

func (d *Discount) MetaRemove(name string) error

func (*Discount) Metas

func (d *Discount) Metas() (map[string]string, error)

func (*Discount) MetasRemove

func (d *Discount) MetasRemove(names []string) error

func (*Discount) MetasUpsert

func (d *Discount) MetasUpsert(metas map[string]string) error

func (*Discount) SetAmount

func (d *Discount) SetAmount(amount float64) DiscountInterface

func (*Discount) SetCode

func (d *Discount) SetCode(code string) DiscountInterface

func (*Discount) SetCreatedAt

func (d *Discount) SetCreatedAt(createdAt string) DiscountInterface

func (*Discount) SetDescription

func (d *Discount) SetDescription(description string) DiscountInterface

func (*Discount) SetEndsAt

func (d *Discount) SetEndsAt(endsAt string) DiscountInterface

func (*Discount) SetID

func (o *Discount) SetID(id string) DiscountInterface

SetID sets the ID of the exam

func (*Discount) SetMemo

func (d *Discount) SetMemo(memo string) DiscountInterface

func (*Discount) SetMeta

func (d *Discount) SetMeta(name string, value string) error

func (*Discount) SetMetas

func (d *Discount) SetMetas(metas map[string]string) error

SetMetas stores metas as json string Warning: it overwrites any existing metas

func (*Discount) SetSoftDeletedAt

func (d *Discount) SetSoftDeletedAt(deletedAt string) DiscountInterface

func (*Discount) SetStartsAt

func (d *Discount) SetStartsAt(startsAt string) DiscountInterface

func (*Discount) SetStatus

func (d *Discount) SetStatus(status string) DiscountInterface

func (*Discount) SetTitle

func (d *Discount) SetTitle(title string) DiscountInterface

func (*Discount) SetType

func (d *Discount) SetType(type_ string) DiscountInterface

func (*Discount) SetUpdatedAt

func (d *Discount) SetUpdatedAt(updatedAt string) DiscountInterface

func (*Discount) SoftDeletedAt

func (d *Discount) SoftDeletedAt() string

func (*Discount) SoftDeletedAtCarbon

func (d *Discount) SoftDeletedAtCarbon() *carbon.Carbon

func (*Discount) StartsAt

func (d *Discount) StartsAt() string

func (*Discount) StartsAtCarbon

func (d *Discount) StartsAtCarbon() *carbon.Carbon

func (*Discount) Status

func (d *Discount) Status() string

func (*Discount) Title

func (d *Discount) Title() string

func (*Discount) Type

func (d *Discount) Type() string

func (*Discount) UpdatedAt

func (d *Discount) UpdatedAt() string

func (*Discount) UpdatedAtCarbon

func (d *Discount) UpdatedAtCarbon() *carbon.Carbon

type DiscountInterface

type DiscountInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	Amount() float64
	SetAmount(amount float64) DiscountInterface

	Code() string
	SetCode(code string) DiscountInterface

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) DiscountInterface

	Description() string
	SetDescription(description string) DiscountInterface

	EndsAt() string
	EndsAtCarbon() *carbon.Carbon
	SetEndsAt(endsAt string) DiscountInterface

	ID() string
	SetID(id string) DiscountInterface

	Memo() string
	SetMemo(memo string) DiscountInterface

	Meta(name string) string
	MetaRemove(name string) error
	SetMeta(name string, value string) error

	Metas() (map[string]string, error)
	MetasRemove(names []string) error
	MetasUpsert(metas map[string]string) error
	SetMetas(metas map[string]string) error

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) DiscountInterface

	StartsAt() string
	StartsAtCarbon() *carbon.Carbon
	SetStartsAt(startsAt string) DiscountInterface

	Status() string
	SetStatus(status string) DiscountInterface

	Title() string
	SetTitle(title string) DiscountInterface

	Type() string
	SetType(type_ string) DiscountInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) DiscountInterface
}

func NewDiscount

func NewDiscount() DiscountInterface

func NewDiscountFromExistingData

func NewDiscountFromExistingData(data map[string]string) DiscountInterface

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

	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

	HasStatus() bool
	Status() string
	SetStatus(status string) DiscountQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) DiscountQueryInterface
	// contains filtered or unexported methods
}

func NewDiscountQuery

func NewDiscountQuery() DiscountQueryInterface

type Media

type Media struct {
	dataobject.DataObject
}

func NewMediaFromExistingData

func NewMediaFromExistingData(data map[string]string) *Media

func (*Media) CreatedAt

func (o *Media) CreatedAt() string

func (*Media) CreatedAtCarbon

func (o *Media) CreatedAtCarbon() *carbon.Carbon

func (*Media) Description

func (o *Media) Description() string

func (*Media) EntityID

func (o *Media) EntityID() string

func (*Media) ID

func (o *Media) ID() string

func (*Media) Memo

func (o *Media) Memo() string

func (*Media) Meta

func (order *Media) Meta(name string) string

func (*Media) Metas

func (order *Media) Metas() (map[string]string, error)

func (*Media) Sequence

func (o *Media) Sequence() int

func (*Media) SetCreatedAt

func (o *Media) SetCreatedAt(createdAt string) MediaInterface

func (*Media) SetDescription

func (o *Media) SetDescription(description string) MediaInterface

func (*Media) SetEntityID

func (o *Media) SetEntityID(entityID string) MediaInterface

func (*Media) SetID

func (o *Media) SetID(id string) MediaInterface

func (*Media) SetMemo

func (o *Media) SetMemo(memo string) MediaInterface

func (*Media) SetMeta

func (order *Media) SetMeta(name string, value string) error

func (*Media) SetMetas

func (order *Media) SetMetas(metas map[string]string) error

SetMetas stores metas as json string Warning: it overwrites any existing metas

func (*Media) SetSequence

func (o *Media) SetSequence(sequence int) MediaInterface

func (*Media) SetSoftDeletedAt

func (o *Media) SetSoftDeletedAt(softDeletedAt string) MediaInterface

func (*Media) SetStatus

func (o *Media) SetStatus(status string) MediaInterface

func (*Media) SetTitle

func (o *Media) SetTitle(title string) MediaInterface

func (*Media) SetType

func (o *Media) SetType(type_ string) MediaInterface

func (*Media) SetURL

func (o *Media) SetURL(url string) MediaInterface

func (*Media) SetUpdatedAt

func (o *Media) SetUpdatedAt(updatedAt string) MediaInterface

func (*Media) SoftDeletedAt

func (o *Media) SoftDeletedAt() string

func (*Media) SoftDeletedAtCarbon

func (o *Media) SoftDeletedAtCarbon() *carbon.Carbon

func (*Media) Status

func (o *Media) Status() string

func (*Media) Title

func (o *Media) Title() string

func (*Media) Type

func (o *Media) Type() string

func (*Media) URL

func (o *Media) URL() string

func (*Media) UpdatedAt

func (o *Media) UpdatedAt() string

func (*Media) UpdatedAtCarbon

func (o *Media) UpdatedAtCarbon() *carbon.Carbon

func (*Media) UpsertMetas

func (order *Media) UpsertMetas(metas map[string]string) error

type MediaInterface

type MediaInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) MediaInterface

	Description() string
	SetDescription(description string) MediaInterface

	EntityID() string
	SetEntityID(entityID string) MediaInterface

	ID() string
	SetID(id string) MediaInterface

	Memo() string
	SetMemo(memo string) MediaInterface

	Metas() (map[string]string, error)
	Meta(name string) string
	SetMeta(name string, value string) error
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Sequence() int
	SetSequence(sequence int) MediaInterface

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(softDeletedAt string) MediaInterface

	Status() string
	SetStatus(status string) MediaInterface

	Title() string
	SetTitle(title string) MediaInterface

	Type() string
	SetType(type_ string) MediaInterface

	URL() string
	SetURL(url string) MediaInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) MediaInterface
}

func NewMedia

func NewMedia() MediaInterface

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
}

func NewOrderFromExistingData

func NewOrderFromExistingData(data map[string]string) *Order

func (*Order) CreatedAt

func (order *Order) CreatedAt() string

func (*Order) CreatedAtCarbon

func (order *Order) CreatedAtCarbon() *carbon.Carbon

func (*Order) CustomerID

func (order *Order) CustomerID() string

func (*Order) ID

func (order *Order) ID() string

func (*Order) IsAwaitingFulfillment

func (order *Order) IsAwaitingFulfillment() bool

func (*Order) IsAwaitingPayment

func (order *Order) IsAwaitingPayment() bool

func (*Order) IsAwaitingPickup

func (order *Order) IsAwaitingPickup() bool

func (*Order) IsAwaitingShipment

func (order *Order) IsAwaitingShipment() bool

func (*Order) IsCancelled

func (order *Order) IsCancelled() bool

func (*Order) IsCompleted

func (order *Order) IsCompleted() bool

func (*Order) IsDeclined

func (order *Order) IsDeclined() bool

func (*Order) IsDisputed

func (order *Order) IsDisputed() bool

func (*Order) IsManualVerificationRequired

func (order *Order) IsManualVerificationRequired() bool

func (*Order) IsPending

func (order *Order) IsPending() bool

func (*Order) IsRefunded

func (order *Order) IsRefunded() bool

func (*Order) IsShipped

func (order *Order) IsShipped() bool

func (*Order) Memo

func (order *Order) Memo() string

func (*Order) Meta

func (order *Order) Meta(name string) string

func (*Order) Metas

func (order *Order) Metas() (map[string]string, error)

func (*Order) Price

func (order *Order) Price() string

func (*Order) PriceFloat

func (order *Order) PriceFloat() float64

func (*Order) Quantity

func (order *Order) Quantity() string

func (*Order) QuantityInt

func (order *Order) QuantityInt() int64

func (*Order) SetCreatedAt

func (order *Order) SetCreatedAt(createdAt string) OrderInterface

func (*Order) SetCustomerID

func (order *Order) SetCustomerID(id string) OrderInterface

func (*Order) SetID

func (order *Order) SetID(id string) OrderInterface

func (*Order) SetMemo

func (order *Order) SetMemo(memo string) OrderInterface

func (*Order) SetMeta

func (order *Order) SetMeta(name string, value string) error

func (*Order) SetMetas

func (order *Order) SetMetas(metas map[string]string) error

SetMetas stores metas as json string Warning: it overwrites any existing metas

func (*Order) SetPrice

func (order *Order) SetPrice(price string) OrderInterface

func (*Order) SetPriceFloat

func (order *Order) SetPriceFloat(price float64) OrderInterface

func (*Order) SetQuantity

func (order *Order) SetQuantity(quantity string) OrderInterface

func (*Order) SetQuantityInt

func (order *Order) SetQuantityInt(quantity int64) OrderInterface

func (*Order) SetSoftDeletedAt

func (order *Order) SetSoftDeletedAt(deletedAt string) OrderInterface

func (*Order) SetStatus

func (order *Order) SetStatus(status string) OrderInterface

func (*Order) SetUpdatedAt

func (order *Order) SetUpdatedAt(updatedAt string) OrderInterface

func (*Order) SoftDeletedAt

func (order *Order) SoftDeletedAt() string

func (*Order) SoftDeletedAtCarbon

func (order *Order) SoftDeletedAtCarbon() *carbon.Carbon

func (*Order) Status

func (order *Order) Status() string

func (*Order) UpdatedAt

func (order *Order) UpdatedAt() string

func (*Order) UpdatedAtCarbon

func (order *Order) UpdatedAtCarbon() *carbon.Carbon

func (*Order) UpsertMetas

func (order *Order) UpsertMetas(metas map[string]string) error

type OrderInterface

type OrderInterface interface {
	// Inherited from DataObject
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	// Methods
	IsAwaitingFulfillment() bool
	IsAwaitingPayment() bool
	IsAwaitingPickup() bool
	IsAwaitingShipment() bool
	IsCancelled() bool
	IsCompleted() bool
	IsDeclined() bool
	IsDisputed() bool
	IsManualVerificationRequired() bool
	IsPending() bool
	IsRefunded() bool
	IsShipped() bool

	// Setters and Getters
	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) OrderInterface

	CustomerID() string
	SetCustomerID(customerID string) OrderInterface

	ID() string
	SetID(id string) OrderInterface

	Memo() string
	SetMemo(memo string) OrderInterface

	Meta(name string) string
	SetMeta(name string, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Price() string
	SetPrice(price string) OrderInterface
	PriceFloat() float64
	SetPriceFloat(price float64) OrderInterface

	Quantity() string
	SetQuantity(quantity string) OrderInterface
	QuantityInt() int64
	SetQuantityInt(quantity int64) OrderInterface

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) OrderInterface

	Status() string
	SetStatus(status string) OrderInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) OrderInterface
}

func NewOrder

func NewOrder() OrderInterface

type OrderLineItem

type OrderLineItem struct {
	dataobject.DataObject
}

func (*OrderLineItem) CreatedAt

func (o *OrderLineItem) CreatedAt() string

func (*OrderLineItem) CreatedAtCarbon

func (o *OrderLineItem) CreatedAtCarbon() *carbon.Carbon

func (*OrderLineItem) ID

func (o *OrderLineItem) ID() string

func (*OrderLineItem) Memo

func (o *OrderLineItem) Memo() string

func (*OrderLineItem) Meta

func (o *OrderLineItem) Meta(name string) string

func (*OrderLineItem) Metas

func (o *OrderLineItem) Metas() (map[string]string, error)

func (*OrderLineItem) OrderID

func (o *OrderLineItem) OrderID() string

func (*OrderLineItem) Price

func (o *OrderLineItem) Price() string

func (*OrderLineItem) PriceFloat

func (o *OrderLineItem) PriceFloat() float64

func (*OrderLineItem) ProductID

func (o *OrderLineItem) ProductID() string

func (*OrderLineItem) Quantity

func (o *OrderLineItem) Quantity() string

func (*OrderLineItem) QuantityInt

func (o *OrderLineItem) QuantityInt() int64

func (*OrderLineItem) SetCreatedAt

func (o *OrderLineItem) SetCreatedAt(createdAt string) OrderLineItemInterface

func (*OrderLineItem) SetID

func (*OrderLineItem) SetMemo

func (o *OrderLineItem) SetMemo(memo string) OrderLineItemInterface

func (*OrderLineItem) SetMeta

func (o *OrderLineItem) SetMeta(name string, value string) error

func (*OrderLineItem) SetMetas

func (o *OrderLineItem) SetMetas(metas map[string]string) error

SetMetas stores metas as json string Warning: it overwrites any existing metas

func (*OrderLineItem) SetOrderID

func (o *OrderLineItem) SetOrderID(orderID string) OrderLineItemInterface

func (*OrderLineItem) SetPrice

func (o *OrderLineItem) SetPrice(price string) OrderLineItemInterface

func (*OrderLineItem) SetPriceFloat

func (o *OrderLineItem) SetPriceFloat(price float64) OrderLineItemInterface

func (*OrderLineItem) SetProductID

func (o *OrderLineItem) SetProductID(productID string) OrderLineItemInterface

func (*OrderLineItem) SetQuantity

func (o *OrderLineItem) SetQuantity(quantity string) OrderLineItemInterface

func (*OrderLineItem) SetQuantityInt

func (o *OrderLineItem) SetQuantityInt(quantity int64) OrderLineItemInterface

func (*OrderLineItem) SetSoftDeletedAt

func (o *OrderLineItem) SetSoftDeletedAt(deletedAt string) OrderLineItemInterface

func (*OrderLineItem) SetStatus

func (o *OrderLineItem) SetStatus(status string) OrderLineItemInterface

func (*OrderLineItem) SetTitle

func (o *OrderLineItem) SetTitle(title string) OrderLineItemInterface

func (*OrderLineItem) SetUpdatedAt

func (o *OrderLineItem) SetUpdatedAt(updatedAt string) OrderLineItemInterface

func (*OrderLineItem) SoftDeletedAt

func (o *OrderLineItem) SoftDeletedAt() string

func (*OrderLineItem) SoftDeletedAtCarbon

func (o *OrderLineItem) SoftDeletedAtCarbon() *carbon.Carbon

func (*OrderLineItem) Status

func (o *OrderLineItem) Status() string

func (*OrderLineItem) Title

func (o *OrderLineItem) Title() string

func (*OrderLineItem) UpdatedAt

func (o *OrderLineItem) UpdatedAt() string

func (*OrderLineItem) UpdatedAtCarbon

func (o *OrderLineItem) UpdatedAtCarbon() *carbon.Carbon

func (*OrderLineItem) UpsertMetas

func (o *OrderLineItem) UpsertMetas(metas map[string]string) error

type OrderLineItemInterface

type OrderLineItemInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) OrderLineItemInterface

	ID() string
	SetID(id string) OrderLineItemInterface

	Memo() string
	SetMemo(memo string) OrderLineItemInterface

	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	Meta(name string) string
	SetMeta(name string, value string) error
	UpsertMetas(metas map[string]string) error

	OrderID() string
	SetOrderID(orderID string) OrderLineItemInterface

	Price() string
	SetPrice(price string) OrderLineItemInterface

	PriceFloat() float64
	SetPriceFloat(price float64) OrderLineItemInterface

	ProductID() string
	SetProductID(productID string) OrderLineItemInterface

	Quantity() string
	SetQuantity(quantity string) OrderLineItemInterface

	QuantityInt() int64
	SetQuantityInt(quantity int64) OrderLineItemInterface

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) OrderLineItemInterface

	Status() string
	SetStatus(status string) OrderLineItemInterface

	Title() string
	SetTitle(title string) OrderLineItemInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) OrderLineItemInterface
}

func NewOrderLineItem

func NewOrderLineItem() OrderLineItemInterface

func NewOrderLineItemFromExistingData

func NewOrderLineItemFromExistingData(data map[string]string) OrderLineItemInterface

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
}

func (*Product) CreatedAt

func (product *Product) CreatedAt() string

func (*Product) CreatedAtCarbon

func (product *Product) CreatedAtCarbon() *carbon.Carbon

func (*Product) Description

func (product *Product) Description() string

func (*Product) ID

func (product *Product) ID() string

func (*Product) IsActive

func (product *Product) IsActive() bool

func (*Product) IsDisabled

func (product *Product) IsDisabled() bool

func (*Product) IsDraft

func (product *Product) IsDraft() bool

func (*Product) IsFree

func (product *Product) IsFree() bool

func (*Product) IsSoftDeleted

func (product *Product) IsSoftDeleted() bool

func (*Product) Memo

func (product *Product) Memo() string

func (*Product) Meta

func (product *Product) Meta(name string) string

func (*Product) Metas

func (product *Product) Metas() (map[string]string, error)

func (*Product) Price

func (product *Product) Price() string

func (*Product) PriceFloat

func (product *Product) PriceFloat() float64

func (*Product) Quantity

func (product *Product) Quantity() string

func (*Product) QuantityInt

func (product *Product) QuantityInt() int64

func (*Product) SetCreatedAt

func (product *Product) SetCreatedAt(createdAt string) ProductInterface

func (*Product) SetDescription

func (product *Product) SetDescription(description string) ProductInterface

func (*Product) SetID

func (product *Product) SetID(id string) ProductInterface

func (*Product) SetMemo

func (product *Product) SetMemo(memo string) ProductInterface

func (*Product) SetMeta

func (product *Product) SetMeta(name string, value string) error

func (*Product) SetMetas

func (product *Product) SetMetas(metas map[string]string) error

SetMetas stores metas as json string Warning: it overwrites any existing metas

func (*Product) SetPrice

func (product *Product) SetPrice(price string) ProductInterface

func (*Product) SetPriceFloat

func (product *Product) SetPriceFloat(price float64) ProductInterface

func (*Product) SetQuantity

func (product *Product) SetQuantity(quantity string) ProductInterface

func (*Product) SetQuantityInt

func (product *Product) SetQuantityInt(quantity int64) ProductInterface

func (*Product) SetShortDescription

func (product *Product) SetShortDescription(shortDescription string) ProductInterface

func (*Product) SetSoftDeletedAt

func (product *Product) SetSoftDeletedAt(deletedAt string) ProductInterface

func (*Product) SetStatus

func (product *Product) SetStatus(status string) ProductInterface

func (*Product) SetTitle

func (product *Product) SetTitle(title string) ProductInterface

func (*Product) SetUpdatedAt

func (product *Product) SetUpdatedAt(updatedAt string) ProductInterface

func (*Product) ShortDescription

func (product *Product) ShortDescription() string

func (*Product) Slug

func (product *Product) Slug() string

func (*Product) SoftDeletedAt

func (product *Product) SoftDeletedAt() string

func (*Product) SoftDeletedAtCarbon

func (product *Product) SoftDeletedAtCarbon() *carbon.Carbon

func (*Product) Status

func (product *Product) Status() string

func (*Product) Title

func (product *Product) Title() string

func (*Product) UpdatedAt

func (product *Product) UpdatedAt() string

func (*Product) UpdatedAtCarbon

func (product *Product) UpdatedAtCarbon() *carbon.Carbon

func (*Product) UpsertMetas

func (product *Product) UpsertMetas(metas map[string]string) error

type ProductInterface

type ProductInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	IsActive() bool
	IsDisabled() bool
	IsDraft() bool
	IsSoftDeleted() bool
	IsFree() bool
	Slug() string

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) ProductInterface

	Description() string
	SetDescription(description string) ProductInterface

	ID() string
	SetID(id string) ProductInterface

	Memo() string
	SetMemo(memo string) ProductInterface

	Meta(name string) string
	SetMeta(name string, value string) error

	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Price() string
	SetPrice(price string) ProductInterface
	PriceFloat() float64
	SetPriceFloat(price float64) ProductInterface

	Quantity() string
	SetQuantity(quantity string) ProductInterface
	QuantityInt() int64
	SetQuantityInt(quantity int64) ProductInterface

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) ProductInterface

	ShortDescription() string
	SetShortDescription(shortDescription string) ProductInterface

	Status() string
	SetStatus(status string) ProductInterface

	Title() string
	SetTitle(title string) ProductInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) ProductInterface
}

func NewProduct

func NewProduct() ProductInterface

func NewProductFromExistingData

func NewProductFromExistingData(data map[string]string) ProductInterface

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
	// 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) AutoMigrate

func (store *Store) AutoMigrate() error

AutoMigrate auto migrate

func (*Store) CategoryCount

func (store *Store) CategoryCount(ctx context.Context, options CategoryQueryInterface) (int64, error)

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 *Store) CategoryDeleteByID(ctx context.Context, id string) error

func (*Store) CategoryFindByID

func (store *Store) CategoryFindByID(ctx context.Context, id string) (CategoryInterface, error)

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 *Store) CategorySoftDeleteByID(ctx context.Context, id string) error

func (*Store) CategoryTableName

func (store *Store) CategoryTableName() string

func (*Store) CategoryUpdate

func (store *Store) CategoryUpdate(ctx context.Context, category CategoryInterface) (err error)

func (*Store) DB

func (store *Store) DB() *sql.DB

func (*Store) DiscountCount

func (store *Store) DiscountCount(ctx context.Context, options DiscountQueryInterface) (int64, error)

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 *Store) DiscountDeleteByID(ctx context.Context, id string) error

func (*Store) DiscountFindByCode

func (store *Store) DiscountFindByCode(ctx context.Context, code string) (DiscountInterface, error)

func (*Store) DiscountFindByID

func (store *Store) DiscountFindByID(ctx context.Context, id string) (DiscountInterface, error)

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 *Store) DiscountSoftDeleteByID(ctx context.Context, id string) error

func (*Store) DiscountTableName

func (store *Store) DiscountTableName() string

func (*Store) DiscountUpdate

func (store *Store) DiscountUpdate(ctx context.Context, discount DiscountInterface) error

func (*Store) EnableDebug

func (store *Store) EnableDebug(debug bool, sqlLogger ...*slog.Logger)

EnableDebug - enables the debug option

func (*Store) MediaCount

func (store *Store) MediaCount(ctx context.Context, options MediaQueryInterface) (int64, error)

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 *Store) MediaDeleteByID(ctx context.Context, id string) error

func (*Store) MediaFindByID

func (store *Store) MediaFindByID(ctx context.Context, id string) (MediaInterface, error)

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 *Store) MediaSoftDeleteByID(ctx context.Context, id string) error

func (*Store) MediaTableName

func (store *Store) MediaTableName() string

func (*Store) MediaUpdate

func (store *Store) MediaUpdate(ctx context.Context, media MediaInterface) (err error)

func (*Store) OrderCount

func (store *Store) OrderCount(ctx context.Context, options OrderQueryInterface) (int64, error)

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 *Store) OrderDeleteByID(ctx context.Context, id string) error

func (*Store) OrderFindByID

func (store *Store) OrderFindByID(ctx context.Context, id string) (OrderInterface, error)

func (*Store) OrderLineItemCount

func (store *Store) OrderLineItemCount(ctx context.Context, options OrderLineItemQueryInterface) (int64, error)

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 *Store) OrderLineItemDeleteByID(ctx context.Context, id string) error

func (*Store) OrderLineItemFindByID

func (store *Store) OrderLineItemFindByID(ctx context.Context, id string) (OrderLineItemInterface, error)

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 *Store) OrderLineItemSoftDeleteByID(ctx context.Context, id string) error

func (*Store) OrderLineItemTableName

func (store *Store) OrderLineItemTableName() string

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 *Store) OrderSoftDeleteByID(ctx context.Context, id string) error

func (*Store) OrderTableName

func (store *Store) OrderTableName() string

func (*Store) OrderUpdate

func (store *Store) OrderUpdate(ctx context.Context, order OrderInterface) error

func (*Store) ProductCount

func (store *Store) ProductCount(ctx context.Context, options ProductQueryInterface) (int64, error)

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 *Store) ProductDeleteByID(ctx context.Context, id string) error

func (*Store) ProductFindByID

func (store *Store) ProductFindByID(ctx context.Context, id string) (ProductInterface, error)

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 *Store) ProductSoftDeleteByID(ctx context.Context, id string) error

func (*Store) ProductTableName

func (store *Store) ProductTableName() string

func (*Store) ProductUpdate

func (store *Store) ProductUpdate(ctx context.Context, product ProductInterface) error

type StoreInterface

type StoreInterface interface {
	AutoMigrate() error
	DB() *sql.DB
	EnableDebug(debug bool, sqlLogger ...*slog.Logger)

	CategoryTableName() string
	DiscountTableName() string
	MediaTableName() string
	OrderTableName() string
	OrderLineItemTableName() string
	ProductTableName() string

	CategoryCount(ctx context.Context, options CategoryQueryInterface) (int64, error)
	CategoryCreate(context context.Context, category CategoryInterface) error
	CategoryDelete(context context.Context, category CategoryInterface) error
	CategoryDeleteByID(context context.Context, categoryID string) error
	CategoryFindByID(context context.Context, categoryID string) (CategoryInterface, error)
	CategoryList(context context.Context, options CategoryQueryInterface) ([]CategoryInterface, error)
	CategorySoftDelete(context context.Context, category CategoryInterface) error
	CategorySoftDeleteByID(context context.Context, categoryID string) error
	CategoryUpdate(contxt context.Context, category CategoryInterface) error

	DiscountCount(ctx context.Context, options DiscountQueryInterface) (int64, error)
	DiscountCreate(ctx context.Context, discount DiscountInterface) error
	DiscountDelete(ctx context.Context, discount DiscountInterface) error
	DiscountDeleteByID(ctx context.Context, discountID string) error
	DiscountFindByID(ctx context.Context, discountID string) (DiscountInterface, error)
	DiscountFindByCode(ctx context.Context, code string) (DiscountInterface, error)
	DiscountList(ctx context.Context, options DiscountQueryInterface) ([]DiscountInterface, error)
	DiscountSoftDelete(ctx context.Context, discount DiscountInterface) error
	DiscountSoftDeleteByID(ctx context.Context, discountID string) error
	DiscountUpdate(ctx context.Context, discount DiscountInterface) error

	MediaCount(ctx context.Context, options MediaQueryInterface) (int64, error)
	MediaCreate(ctx context.Context, media MediaInterface) error
	MediaDelete(ctx context.Context, media MediaInterface) error
	MediaDeleteByID(ctx context.Context, mediaID string) error
	MediaFindByID(ctx context.Context, mediaID string) (MediaInterface, error)
	MediaList(ctx context.Context, options MediaQueryInterface) ([]MediaInterface, error)
	MediaSoftDelete(ctx context.Context, media MediaInterface) error
	MediaSoftDeleteByID(ctx context.Context, mediaID string) error
	MediaUpdate(ctx context.Context, media MediaInterface) error

	OrderCount(ctx context.Context, options OrderQueryInterface) (int64, error)
	OrderCreate(ctx context.Context, order OrderInterface) error
	OrderDelete(ctx context.Context, order OrderInterface) error
	OrderDeleteByID(ctx context.Context, id string) error
	OrderFindByID(ctx context.Context, id string) (OrderInterface, error)
	OrderList(ctx context.Context, options OrderQueryInterface) ([]OrderInterface, error)
	OrderSoftDelete(ctx context.Context, order OrderInterface) error
	OrderSoftDeleteByID(ctx context.Context, id string) error
	OrderUpdate(ctx context.Context, order OrderInterface) error

	OrderLineItemCount(ctx context.Context, options OrderLineItemQueryInterface) (int64, error)
	OrderLineItemCreate(ctx context.Context, orderLineItem OrderLineItemInterface) error
	OrderLineItemDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
	OrderLineItemDeleteByID(ctx context.Context, id string) error
	OrderLineItemFindByID(ctx context.Context, id string) (OrderLineItemInterface, error)
	OrderLineItemList(ctx context.Context, options OrderLineItemQueryInterface) ([]OrderLineItemInterface, error)
	OrderLineItemSoftDelete(ctx context.Context, orderLineItem OrderLineItemInterface) error
	OrderLineItemSoftDeleteByID(ctx context.Context, id string) error
	OrderLineItemUpdate(ctx context.Context, orderLineItem OrderLineItemInterface) error

	ProductCount(ctx context.Context, options ProductQueryInterface) (int64, error)
	ProductCreate(ctx context.Context, product ProductInterface) error
	ProductDelete(ctx context.Context, product ProductInterface) error
	ProductDeleteByID(ctx context.Context, productID string) error
	ProductFindByID(ctx context.Context, productID string) (ProductInterface, error)
	ProductList(ctx context.Context, options ProductQueryInterface) ([]ProductInterface, error)
	ProductSoftDelete(ctx context.Context, product ProductInterface) error
	ProductSoftDeleteByID(ctx context.Context, productID string) error
	ProductUpdate(ctx context.Context, product ProductInterface) error
}

Jump to

Keyboard shortcuts

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