Documentation ¶
Index ¶
- type TaggedValue
- type TaggedValueSet
- func (t TaggedValueSet[T]) HasTag(tags ...string) bool
- func (t TaggedValueSet[T]) HasValue(value ...T) bool
- func (t TaggedValueSet[T]) Join(taggedValues ...TaggedValue[T]) TaggedValueSet[T]
- func (t TaggedValueSet[T]) Remove(tags ...string) TaggedValueSet[T]
- func (t TaggedValueSet[T]) Select(tags ...string) TaggedValueSet[T]
- func (t TaggedValueSet[T]) Tags() (tags []string)
- func (t TaggedValueSet[T]) Values() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TaggedValue ¶
TaggedValue holds an arbitrary value with associated tags
func NewTaggedValue ¶
func NewTaggedValue[T any](value T, tags ...string) TaggedValue[T]
NewTaggedValue returns a tagged value, that can be added, for example, to a TaggedValueSet collection
func (TaggedValue[T]) HasTag ¶
func (t TaggedValue[T]) HasTag(tags ...string) bool
HasTag indicates the TaggedValue has a tag matching one or more of the provided arguments
type TaggedValueSet ¶
type TaggedValueSet[T comparable] []TaggedValue[T]
TaggedValueSet is a utility to handle a sorted set of tagged items including basic filtering
func (TaggedValueSet[T]) HasTag ¶
func (t TaggedValueSet[T]) HasTag(tags ...string) bool
HasTag indicates this set contains one or more items matching any of the provided tags
func (TaggedValueSet[T]) HasValue ¶
func (t TaggedValueSet[T]) HasValue(value ...T) bool
HasValue indicates any of the provided values is present in this set
func (TaggedValueSet[T]) Join ¶
func (t TaggedValueSet[T]) Join(taggedValues ...TaggedValue[T]) TaggedValueSet[T]
Join returns a new set of values, combining this set and the provided values, omitting duplicates
func (TaggedValueSet[T]) Remove ¶
func (t TaggedValueSet[T]) Remove(tags ...string) TaggedValueSet[T]
Remove returns a new set of values, excluding those with any of the provided tags
func (TaggedValueSet[T]) Select ¶
func (t TaggedValueSet[T]) Select(tags ...string) TaggedValueSet[T]
Select returns a new set of values matching any of the provided tags, ordered by the provided tags
func (TaggedValueSet[T]) Tags ¶
func (t TaggedValueSet[T]) Tags() (tags []string)
Tags returns the unique set of tags from all entries
func (TaggedValueSet[T]) Values ¶
func (t TaggedValueSet[T]) Values() []T
Values returns a slice containing the values in the set