Documentation ¶
Overview ¶
Package decorator contains all implementations of LabelStrategy.
Index ¶
- Variables
- type LabelKey
- type LabelStrategy
- type NaiveLabelStrategy
- func (s NaiveLabelStrategy) CrossBorder(startKey, endKey string) bool
- func (s NaiveLabelStrategy) Label(key string) LabelKey
- func (s NaiveLabelStrategy) LabelGlobalEnd() LabelKey
- func (s NaiveLabelStrategy) LabelGlobalStart() LabelKey
- func (s NaiveLabelStrategy) ReloadConfig(cfg *config.KeyVisualConfig)
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) // CrossBorder determines whether two keys not belong to the same logical range. CrossBorder(startKey, endKey string) bool // Label returns the Label information of the key. // Note: When the key is "", need to use LabelGlobalStart or LabelGlobalEnd. Label(key string) LabelKey LabelGlobalStart() LabelKey LabelGlobalEnd() LabelKey }
LabelStrategy requires cross-border determination and key decoration scheme.
func SeparatorLabelStrategy ¶
func SeparatorLabelStrategy(cfg *config.KeyVisualConfig) LabelStrategy
type NaiveLabelStrategy ¶
type NaiveLabelStrategy struct{}
NaiveLabelStrategy is one of the simplest LabelStrategy.
func (NaiveLabelStrategy) CrossBorder ¶
func (s NaiveLabelStrategy) CrossBorder(startKey, endKey string) bool
CrossBorder always returns false. So NaiveLabelStrategy believes that there are no cross-border situations.
func (NaiveLabelStrategy) Label ¶
func (s NaiveLabelStrategy) Label(key string) LabelKey
Label only decodes the key.
func (NaiveLabelStrategy) LabelGlobalEnd ¶
func (s NaiveLabelStrategy) LabelGlobalEnd() LabelKey
func (NaiveLabelStrategy) LabelGlobalStart ¶
func (s NaiveLabelStrategy) LabelGlobalStart() LabelKey
func (NaiveLabelStrategy) ReloadConfig ¶
func (s NaiveLabelStrategy) ReloadConfig(cfg *config.KeyVisualConfig)
Click to show internal directories.
Click to hide internal directories.