Documentation
¶
Index ¶
- type Catalog
- func (c *Catalog) AddCategory(cat *Category)
- func (c *Catalog) AddCategoryFromMarkdown(filename, content string) error
- func (c *Catalog) AddCollection(coll *Collection)
- func (c *Catalog) AddCollectionFromMarkdown(filename, content string) error
- func (c *Catalog) AddProduct(p *Product)
- func (c *Catalog) AddProductFromMarkdown(filename, content string) error
- func (c *Catalog) AllCategories() []*Category
- func (c *Catalog) AllCollections() []*Collection
- func (c *Catalog) AllProducts() []*Product
- func (c *Catalog) BuildCategoryHierarchy()
- func (c *Catalog) CategoryCount() int
- func (c *Catalog) CollectionCount() int
- func (c *Catalog) Commit() string
- func (c *Catalog) GetCategory(id string) (*Category, bool)
- func (c *Catalog) GetCategoryBySlug(slug string) (*Category, bool)
- func (c *Catalog) GetCollection(id string) (*Collection, bool)
- func (c *Catalog) GetCollectionBySlug(slug string) (*Collection, bool)
- func (c *Catalog) GetProduct(id string) (*Product, bool)
- func (c *Catalog) GetProductBySKU(sku string) (*Product, bool)
- func (c *Catalog) LoadedAt() time.Time
- func (c *Catalog) ProductCount() int
- type Category
- type Collection
- type Loader
- type Product
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog holds all catalog entities loaded from git
func (*Catalog) AddCategory ¶
AddCategory adds a category to the catalog
func (*Catalog) AddCategoryFromMarkdown ¶
AddCategoryFromMarkdown parses markdown and adds category
func (*Catalog) AddCollection ¶
func (c *Catalog) AddCollection(coll *Collection)
AddCollection adds a collection to the catalog
func (*Catalog) AddCollectionFromMarkdown ¶
AddCollectionFromMarkdown parses markdown and adds collection
func (*Catalog) AddProduct ¶
AddProduct adds a product to the catalog
func (*Catalog) AddProductFromMarkdown ¶
AddProductFromMarkdown parses markdown and adds product
func (*Catalog) AllCategories ¶
AllCategories returns all categories
func (*Catalog) AllCollections ¶
func (c *Catalog) AllCollections() []*Collection
AllCollections returns all collections
func (*Catalog) AllProducts ¶
AllProducts returns all products
func (*Catalog) BuildCategoryHierarchy ¶
func (c *Catalog) BuildCategoryHierarchy()
BuildCategoryHierarchy builds parent-child relationships and computes path/depth for all categories in the catalog
func (*Catalog) CategoryCount ¶
CategoryCount returns the number of categories
func (*Catalog) CollectionCount ¶
CollectionCount returns the number of collections
func (*Catalog) GetCategory ¶
GetCategory retrieves a category by ID
func (*Catalog) GetCategoryBySlug ¶
GetCategoryBySlug retrieves a category by slug
func (*Catalog) GetCollection ¶
func (c *Catalog) GetCollection(id string) (*Collection, bool)
GetCollection retrieves a collection by ID
func (*Catalog) GetCollectionBySlug ¶
func (c *Catalog) GetCollectionBySlug(slug string) (*Collection, bool)
GetCollectionBySlug retrieves a collection by slug
func (*Catalog) GetProduct ¶
GetProduct retrieves a product by ID
func (*Catalog) GetProductBySKU ¶
GetProductBySKU retrieves a product by SKU
func (*Catalog) ProductCount ¶
ProductCount returns the number of products
type Category ¶
type Category struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Slug string `yaml:"slug"`
ParentID *string `yaml:"parent_id"`
DisplayOrder int `yaml:"display_order"`
CreatedAt time.Time `yaml:"created_at"`
UpdatedAt time.Time `yaml:"updated_at"`
Body string `yaml:"-"`
// Computed fields (built by BuildCategoryHierarchy)
Parent *Category `yaml:"-"`
Children []*Category `yaml:"-"`
Path []*Category `yaml:"-"` // Root to current
Depth int `yaml:"-"`
}
Category represents a hierarchical classification
type Collection ¶
type Collection struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Slug string `yaml:"slug"`
DisplayOrder int `yaml:"display_order"`
ProductIDs []string `yaml:"product_ids"`
CreatedAt time.Time `yaml:"created_at"`
UpdatedAt time.Time `yaml:"updated_at"`
Body string `yaml:"-"`
}
Collection represents a flat grouping of products
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader loads catalog data from git repository
func (*Loader) LoadFromHEAD ¶
LoadFromHEAD loads catalog from the current HEAD commit
func (*Loader) LoadFromLatestTag ¶
LoadFromLatestTag loads catalog from the latest release tag
type Product ¶
type Product struct {
ID string `yaml:"id"`
SKU string `yaml:"sku"`
Title string `yaml:"title"`
Price float64 `yaml:"price"`
Currency string `yaml:"currency"`
InventoryStatus string `yaml:"inventory_status"`
InventoryQuantity *int `yaml:"inventory_quantity"`
CategoryID string `yaml:"category_id"`
CollectionIDs []string `yaml:"collection_ids"`
Images []string `yaml:"images"`
Metadata map[string]interface{} `yaml:"metadata"`
CreatedAt time.Time `yaml:"created_at"`
UpdatedAt time.Time `yaml:"updated_at"`
Body string `yaml:"-"` // Markdown body
}
Product represents a sellable item