variant

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

Types

type Option

type Option struct {
	// Ex. Size
	Name string `json:"name"`
	// Ex. M
	Value string `json:"value"`
}

type Variant

type Variant struct {
	mixin.Model[Variant]
	mixin.Salesforce
	productcachedvalues.ProductCachedValues

	ProductId string `json:"productId"`

	SKU string `json:"sku"`
	UPC string `json:"upc,omitempty"`

	Name string `json:"name"`

	// Variant Media
	Header Media   `json:"header"`
	Image  Media   `json:"image"`
	Media  []Media `json:"media"`

	// Is the variant available
	Available bool `json:"available"`

	// Range in which variant is available. If active, it takes precedent over
	// Available bool.
	Availability Availability `json:"availability"`

	// Inventory int `json:"inventory"`
	Sold int `json:"sold"`

	Options []Option `json:"options"`
}

func Fake

func Fake(db *datastore.Datastore, productId string) *Variant

func New

func New(db *datastore.Datastore) *Variant

func (*Variant) Defaults

func (v *Variant) Defaults()

func (*Variant) Validator

func (v *Variant) Validator() *val.Validator

Jump to

Keyboard shortcuts

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