domain

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 5 Imported by: 16

Documentation

Index

Constants

View Source
const (
	TypeProduct   = "product"
	TypeTeaser    = "teaser"
	TypePromotion = "promotion"
)

Category Types

View Source
const (
	MediaUsageTeaser = "teaser"
	MediaUsageDetail = "detail"
)

Media usage constants

View Source
const (
	// CategoryKey donates the default category facet key
	CategoryKey categoryKey = "category"
)

Variables

View Source
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

} //@name CategoryAttribute

Attribute instance representation

func (Attribute) ToString

func (a Attribute) ToString() string

ToString returns a concatenated string of all the values of an attribute

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

type Attributes map[string]Attribute //@name CategoryAttributes

Attributes define additional category attributes

func (Attributes) All

func (a Attributes) All() []Attribute

All returns all Attributes as slice

func (Attributes) Get

func (a Attributes) Get(code string) *Attribute

Get by key

func (Attributes) Has

func (a Attributes) Has(code string) bool

Has by key

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) Active

func (c CategoryData) Active() bool

Active indicator

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) Code

func (c CategoryData) Code() string

Code gets the category code

func (CategoryData) Media

func (c CategoryData) Media() Medias

Media gets the category media

func (CategoryData) Name

func (c CategoryData) Name() string

Name gets the category name

func (CategoryData) Path

func (c CategoryData) Path() string

Path gets the category path

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

func (MediaData) MimeType

func (m MediaData) MimeType() string

MimeType gets the media mime type

func (MediaData) Reference

func (m MediaData) Reference() string

Reference gets the media reference

func (MediaData) Title

func (m MediaData) Title() string

Title gets the media title

func (MediaData) Type

func (m MediaData) Type() string

Type gets the media type

func (MediaData) Usage

func (m MediaData) Usage() string

Usage gets the media usage

type Medias

type Medias []Media

Medias defines the category media slice

func (Medias) Get

func (m Medias) Get(usage string) Media

Get returns a *Media with `usage`, empty media result if none was found

func (Medias) Has

func (m Medias) Has(usage string) bool

Has checks if the Medias contain a media with `usage`

type Promotion

type Promotion struct {
	LinkType   string
	LinkTarget string
	Media      Medias
}

Promotion defines promotion for a category

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) Active

func (c TreeData) Active() bool

Active gets the node (category) active state

func (TreeData) Code

func (c TreeData) Code() string

Code gets the category code represented by this node in the tree

func (TreeData) DocumentCount

func (c TreeData) DocumentCount() int

DocumentCount gets the amount of documents in that node

func (TreeData) HasChilds

func (c TreeData) HasChilds() bool

HasChilds - true if subTrees exist

func (TreeData) Name

func (c TreeData) Name() string

Name gets the category name

func (TreeData) Path

func (c TreeData) Path() string

Path gets the Node (category) path

func (TreeData) SubTrees

func (c TreeData) SubTrees() []Tree

SubTrees gets the child Trees

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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