types

package
v1.49.64 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaVideo      MediaType = "video"
	MediaImage                = "image"
	MediaLiveStream           = "livestream"
	MediaWebGL                = "webgl"
	MediaAudio                = "audio"
	MediaEmbed                = "embed"
)
View Source
const (
	MassLbs   MassUnit = "lb"
	MassKilo           = "kg"
	MassGrams          = "g"
)

Variables

View Source
var BuyerEmailOrPhoneRequired = errors.New("Buyer's Email or Phone is required.")

Functions

func DisplayPrice

func DisplayPrice(t currency.Type, price currency.Cents) string

DisplayPrice renders a price for a human: symbol, grouped thousands, the currency's own number of decimals ("$1,234.56", "¥10,000").

This is the display funnel — every storefront, order and receipt string in commerce comes through here, so it holds no arithmetic of its own. The amount is rendered from the integer by money, which cannot round a cent away the way the float this used to compute could.

A negative now renders "-$100.00" rather than the old "$-100.00": the sign belongs to the amount, not to the digits after the symbol, and a refund is the most common negative there is.

func DisplayTitle

func DisplayTitle(title string) string

Non-breaking hyphens in title

func SplitParagraph

func SplitParagraph(text string) []string

Types

type Address

type Address struct {
	Name       string `json:"name,omitempty"`
	Line1      string `json:"line1,omitempty"`
	Line2      string `json:"line2,omitempty"`
	City       string `json:"city,omitempty"`
	State      string `json:"state,omitempty"`
	PostalCode string `json:"postalCode,omitempty"`
	Country    string `json:"country,omitempty"`
}

func (Address) Empty

func (a Address) Empty() bool

func (Address) Line

func (a Address) Line() string

type Adjustment

type Adjustment struct {
	// Possible values: flat.
	Type string `json:"type"`
	// Reasoning for price adjustment.
	Reason string `json:"reason"`
	// Authorizer of price adjustment.
	Issuer string `json:"issuer"`
	// Amount of price adjustment.
	Amount currency.Cents `json:"amount"`
}

type Availability

type Availability struct {
	Active    bool      `json:"active"`
	StartDate time.Time `json:"startDate"`
	EndDate   time.Time `json:"endDate"`
}

type Buyer

type Buyer struct {
	Email     string `json:"email,omitempty"`
	UserId    string `json:"userId,omitempty"`
	FirstName string `json:"firstName,omitempty"`
	LastName  string `json:"lastName,omitempty"`
	Company   string `json:"company,omitempty"`
	Phone     string `json:"phone,omitempty"`
	// Address   Address `json:"address,omitempty"`
	ShippingAddress Address `json:"shippingAddress,omitempty"`
	BillingAddress  Address `json:"billingAddress,omitempty"`
}

func (Buyer) Name

func (b Buyer) Name() string

func (Buyer) Validate

func (b Buyer) Validate() (bool, []error)

type Event

type Event struct {
	Type string `json:"type"`
	Desc string `json:"desc"`
}

type Interval

type Interval string
const (
	Yearly  Interval = "year"
	Monthly Interval = "month"
)

type KYCStatus

type KYCStatus string
const (
	KYCStatusApproved  KYCStatus = "approved"
	KYCStatusDenied    KYCStatus = "denied"
	KYCStatusPending   KYCStatus = "pending"
	KYCStatusInitiated KYCStatus = "initiated"
)

type Map

type Map map[string]interface{}

type MassUnit

type MassUnit string

type Media

type Media struct {
	Type MediaType `json:"type"`
	Alt  string    `json:"alt"`
	Url  string    `json:"url"`
	X    int       `json:"x"`
	Y    int       `json:"y"`
}

func (Media) Dimensions

func (i Media) Dimensions() string

func (Media) Validate

func (i Media) Validate(req *http.Request, errs binding.Errors) binding.Errors

type MediaType

type MediaType string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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