Documentation ¶
Index ¶
Constants ¶
const ContentTypeHTML = "HTML"
const ContentTypeSimple = "SIMPLE"
const ProductStatusArchived = "ARCHIVED"
const ProductStatusAvailable = "AVAILABLE"
Variables ¶
var ErrInvalidEntity = errors.New("invalid entity")
ErrInvalidEntity indicates the provided entity is invalid
var ErrInvalidID = errors.New("invalid id")
ErrInvalidID indicates the provided id is malformed
var ErrNotFound = errors.New("not found")
ErrNotFound indicates the requested entity is not found
Functions ¶
Types ¶
type AmountInCents ¶ added in v0.5.0
type AmountInCents struct {
// contains filtered or unexported fields
}
func NewAmountInCents ¶ added in v0.5.0
func NewAmountInCents(amountInCents int) AmountInCents
func NewAmountInCentsFromString ¶ added in v0.5.0
func NewAmountInCentsFromString(amount string) (AmountInCents, error)
NewAmountInCentsFromString converts a decimal string into an AmountInCents, without using float conversions
func (AmountInCents) Int ¶ added in v0.5.0
func (a AmountInCents) Int() int
func (AmountInCents) String ¶ added in v0.5.0
func (a AmountInCents) String() string
FormatPrice formats a price in cents into a decimal string, without using float conversions.
type Category ¶
type Category struct { ID ID Name string Description string // ID of the parent. // uuid.Nil means it's a root category ParentID ID // Order (priority) of the category. // 1 = highest, inf = lowest Order int ProductIDs []ID Image *Image }
Category data
type Content ¶ added in v0.3.0
type Content struct { Name string ContentType ContentType Body string }
Content data
type ContentType ¶ added in v0.3.0
type ContentType string
func (ContentType) IsValid ¶ added in v0.3.0
func (contentType ContentType) IsValid() bool
func (ContentType) String ¶ added in v0.3.0
func (contentType ContentType) String() string
type Event ¶ added in v0.3.0
type Event struct { ID ID Name string Description string EventType string Start time.Time End time.Time WholeDay bool }
Event data
type GoComError ¶
type GoComError struct { // HTTP status code Status int `json:"status"` // Original error Err error `json:"-"` // Error code Code string `json:"code"` // Human-readable description of the error Message string `json:"message"` // Optional - On which object to error occurred Instance string `json:"instance"` }
GoComError allows to bundle a status with the original error. This allows to fine-grained response codes at the API level.
func (*GoComError) Error ¶
func (e *GoComError) Error() string
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID contains an entity ID, which is a valid UUID. ID type is created to make it library agnostic and to add useful helpers like IsNil.
func NewIDFromBytes ¶ added in v0.5.0
NewIDFromString convert a bytes slice to an entity ID
func NewIDFromString ¶ added in v0.5.0
NewIDFromString convert a string to an entity ID
type Image ¶
func (*Image) SetURLsFromConfigs ¶
func (img *Image) SetURLsFromConfigs(service imageproxy.Service, configs map[string]imageproxy.ImageConfig) error
SetURLsFromConfigs generates and sets an URL from the provided config
type Manufacturer ¶
Manufacturer data
func (*Manufacturer) Clean ¶ added in v0.5.0
func (m *Manufacturer) Clean()
func (*Manufacturer) Validate ¶
func (m *Manufacturer) Validate() error
Validate cleans and validates the manufacturer data
type Product ¶
type Product struct { ID ID CreatedAt time.Time UpdatedAt time.Time Name string DescriptionShort string DescriptionLong string // Price of a single product in cents (1/100) Price AmountInCents CategoryIDs []ID ManufacturerID ID Status ProductStatus StockCount int Images []*Image }
Product data
type ProductStatus ¶
type ProductStatus string
func (ProductStatus) String ¶
func (status ProductStatus) String() string
type ResolvedProduct ¶
type ResolvedProduct struct { Product Manufacturer *Manufacturer Categories []*Category }
ResolvedProduct is a product for which related entities are included. This way all information is immediately at hand.