Documentation ¶
Index ¶
- Constants
- Variables
- type Attribute
- type AttributeValue
- type Attributes
- type Category
- type CategoryData
- func (c CategoryData) Active() bool
- func (c CategoryData) Attributes() Attributes
- func (c CategoryData) CategoryType() string
- func (c CategoryData) Code() string
- func (c CategoryData) Media() Medias
- func (c CategoryData) Name() string
- func (c CategoryData) Path() string
- func (c CategoryData) Promoted() bool
- type CategoryFacet
- type CategoryService
- type Media
- type MediaData
- type Medias
- type Promotion
- type Tree
- type TreeData
Constants ¶
const ( TypeProduct = "product" TypePromotion = "promotion" )
Category Types
const ( MediaUsageDetail = "detail" )
Media usage constants
const (
// CategoryKey donates the default category facet key
CategoryKey categoryKey = "category"
)
Variables ¶
var ( // ErrNotFound error ErrNotFound = errors.New("category not found") )
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute struct { Code string Label string Values []AttributeValue }
Attribute instance representation
type AttributeValue ¶
type AttributeValue struct { Label string RawValue interface{} }
AttributeValue represents the value that a Attribute can have
func (AttributeValue) Value ¶
func (av AttributeValue) Value() string
Value returns string representation of the RawValue
type Attributes ¶
Attributes define additional category attributes
type Category ¶
type Category interface { Code() string Name() string Path() string Promoted() bool Active() bool CategoryType() string Media() Medias Attributes() Attributes }
Category domain model
type CategoryData ¶
type CategoryData struct { CategoryCode string CategoryName string CategoryPath string IsPromoted bool IsActive bool CategoryMedia Medias CategoryTypeCode string CategoryAttributes Attributes Promotion Promotion }
CategoryData defines the default domain category data model
func (CategoryData) Attributes ¶
func (c CategoryData) Attributes() Attributes
Attributes gets the additional category attributes
func (CategoryData) CategoryType ¶
func (c CategoryData) CategoryType() string
CategoryType gets the category type code
func (CategoryData) Promoted ¶
func (c CategoryData) Promoted() bool
Promoted gets the category promoted state
type CategoryFacet ¶
type CategoryFacet struct {
CategoryCode string
}
CategoryFacet search filter
func NewCategoryFacet ¶
func NewCategoryFacet(categoryCode string) CategoryFacet
NewCategoryFacet filter factory
func (CategoryFacet) Value ¶
func (cf CategoryFacet) Value() (string, []string)
Value for category/domain.Filter
type CategoryService ¶
type CategoryService interface { // Tree a category Tree(ctx context.Context, activeCategoryCode string) (Tree, error) // Get a category with more data Get(ctx context.Context, categoryCode string) (Category, error) }
CategoryService interface
type Media ¶
type Media interface { Type() string MimeType() string Usage() string Title() string Reference() string }
Media provides the category media interface
type MediaData ¶
type MediaData struct { MediaType string MediaMimeType string MediaTitle string MediaReference string MediaUsage string }
MediaData defines the default domain category media data model
type Medias ¶
type Medias []Media
Medias defines the category media slice
type Tree ¶
type Tree interface { //Code - returns the idendifier of the category Code() string //Name - returns the name of the category Name() string //Path returns the Path as string Path() string //Active - should return true if the category is in the rootpath of the current category Active() bool //Subtrees returns a list of subtrees of the current node SubTrees() []Tree //HasChilds returns true if the node is no leaf node HasChilds() bool //DocumentCount - the amount of documents (products) in the category DocumentCount() int }
Tree domain model
type TreeData ¶
type TreeData struct { CategoryCode string CategoryName string CategoryPath string CategoryDocumentCount int SubTreesData []*TreeData IsActive bool }
TreeData defines the default domain tree data model
func (TreeData) DocumentCount ¶
DocumentCount gets the amount of documents in that node