Documentation ¶
Overview ¶
Package decorator contains all implementations of LabelStrategy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNS = errorx.NewNamespace("error.keyvisual") ErrNSDecorator = ErrNS.NewSubNamespace("decorator") ErrInvalidData = ErrNSDecorator.NewType("invalid_data") )
Functions ¶
This section is empty.
Types ¶
type LabelKey ¶
type LabelKey struct { Key string `json:"key" binding:"required"` Labels []string `json:"labels" binding:"required"` }
LabelKey is the decoration key.
type LabelStrategy ¶
type LabelStrategy interface { ReloadConfig(cfg *config.KeyVisualConfig) NewLabeler() Labeler }
LabelStrategy requires cross-border determination and key decoration scheme. It supports dynamic reload configuration and generation of an actuator.
func NaiveLabelStrategy ¶
func NaiveLabelStrategy() LabelStrategy
NaiveLabelStrategy is one of the simplest LabelStrategy.
func SeparatorLabelStrategy ¶
func SeparatorLabelStrategy(cfg *config.KeyVisualConfig) LabelStrategy
SeparatorLabelStrategy implements the LabelStrategy interface. It obtains label information after splitting the key.
type Labeler ¶
type Labeler interface { // CrossBorder determines whether two keys not belong to the same logical range. CrossBorder(startKey, endKey string) bool // Label returns the Label information of the keys. Label(keys []string) []LabelKey }
Labeler is an executor of LabelStrategy, and its functions should not be called concurrently.
Click to show internal directories.
Click to hide internal directories.