Documentation
¶
Index ¶
- type Bitset64
- type Integer
- type Node
- type NumberBitset
- func (b *NumberBitset[T]) ContainsAllFrom(set *NumberBitset[T]) (res bool)
- func (b *NumberBitset[T]) Has(v T) bool
- func (b *NumberBitset[T]) HasOneOf(vals ...T) bool
- func (b *NumberBitset[T]) Len() int
- func (b *NumberBitset[T]) Mask() uint64
- func (b *NumberBitset[T]) Reset() *NumberBitset[T]
- func (b *NumberBitset[T]) Set(vals ...T) *NumberBitset[T]
- func (b *NumberBitset[T]) Unset(vals ...T) *NumberBitset[T]
- func (b *NumberBitset[T]) Values() []T
- type ObjectBitset
- type U64KeywordMatcher
- type U64StringMatcher
- func (m *U64StringMatcher) AllChildrenID(id uint64) []uint64
- func (m *U64StringMatcher) Freeze() *U64StringMatcher
- func (m *U64StringMatcher) MatchAllChildrenID(key string) []uint64
- func (m *U64StringMatcher) MatchCode(id uint64) string
- func (m *U64StringMatcher) MatchID(id uint64, key string) uint64
- func (m *U64StringMatcher) ParentID(id uint64) uint64
- func (m *U64StringMatcher) Set(parentID, id uint64, value string) *U64StringMatcher
- func (m *U64StringMatcher) SetNodes(nodes ...Node) *U64StringMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Integer ¶
type Integer interface {
~uint | ~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint8 | ~uint16 | ~uint32 | ~uint64
}
Integer type constraint for generic NumberBitset
type NumberBitset ¶
type NumberBitset[T Integer] struct { // contains filtered or unexported fields }
NumberBitset any numbers
func NewNumberBitset ¶
func NewNumberBitset[T Integer](vals ...T) (b *NumberBitset[T])
NewNumberBitset from numbers
func (*NumberBitset[T]) ContainsAllFrom ¶
func (b *NumberBitset[T]) ContainsAllFrom(set *NumberBitset[T]) (res bool)
ContainsAllFrom items from the set
func (*NumberBitset[T]) HasOneOf ¶
func (b *NumberBitset[T]) HasOneOf(vals ...T) bool
HasOneOf reports whether the set contains any of vals.
func (*NumberBitset[T]) Reset ¶
func (b *NumberBitset[T]) Reset() *NumberBitset[T]
Reset bitset value
func (*NumberBitset[T]) Set ¶
func (b *NumberBitset[T]) Set(vals ...T) *NumberBitset[T]
Set type values
func (*NumberBitset[T]) Unset ¶
func (b *NumberBitset[T]) Unset(vals ...T) *NumberBitset[T]
Unset type values
type ObjectBitset ¶
type ObjectBitset struct {
// contains filtered or unexported fields
}
ObjectBitset any numbers
func NewObjectBitset ¶
func NewObjectBitset(cmp func(a, b any) int, value func(o1 any) uint, vals ...any) (b *ObjectBitset)
NewObjectBitset from numbers
func (*ObjectBitset) HasOneOf ¶
func (b *ObjectBitset) HasOneOf(vals ...any) bool
HasOneOf reports whether the set contains any of vals. Membership is the same == check as Has, not cmp == 0.
func (*ObjectBitset) Unset ¶
func (b *ObjectBitset) Unset(vals ...any) *ObjectBitset
Unset type values
type U64KeywordMatcher ¶
type U64KeywordMatcher struct {
// contains filtered or unexported fields
}
U64KeywordMatcher maps keyword phrases to uint64 IDs with word-start prefix matching. Lifecycle: Set → Freeze → concurrent Match (no locks).
Matching: from each whitespace-delimited word start in the input, walk the trie. Intermediate phrase words must match exactly (then whitespace); the final phrase word may be a prefix of the input word (e.g. "racing" matches "racings"). Among hits, the longest normalized phrase wins; ties prefer the first word-start.
func NewU64KeywordMatcher ¶
func NewU64KeywordMatcher() *U64KeywordMatcher
NewU64KeywordMatcher creates an empty matcher.
func (*U64KeywordMatcher) Freeze ¶
func (m *U64KeywordMatcher) Freeze() *U64KeywordMatcher
Freeze seals the matcher into contiguous node/edge arenas for Match.
func (*U64KeywordMatcher) Match ¶
func (m *U64KeywordMatcher) Match(input string) uint64
Match finds the best category ID for input, or 0.
func (*U64KeywordMatcher) Set ¶
func (m *U64KeywordMatcher) Set(phrase string, id uint64) *U64KeywordMatcher
Set registers or overwrites a phrase → id mapping. Empty / whitespace-only phrases are skipped.
type U64StringMatcher ¶
type U64StringMatcher struct {
// contains filtered or unexported fields
}
U64StringMatcher is a build-once string↔uint64 tree matcher (e.g. IAB categories). Lifecycle: Set / SetNodes → Freeze → concurrent Match* (no locks).
func NewU64StringMatcher ¶
func NewU64StringMatcher() *U64StringMatcher
NewU64StringMatcher creates an empty matcher.
func (*U64StringMatcher) AllChildrenID ¶
func (m *U64StringMatcher) AllChildrenID(id uint64) []uint64
AllChildrenID returns all descendant IDs of id (self not included). After Freeze the slice is internal/shared — do not mutate.
func (*U64StringMatcher) Freeze ¶
func (m *U64StringMatcher) Freeze() *U64StringMatcher
Freeze seals the matcher and materializes full descendant ID lists.
func (*U64StringMatcher) MatchAllChildrenID ¶
func (m *U64StringMatcher) MatchAllChildrenID(key string) []uint64
MatchAllChildrenID resolves key globally, then returns AllChildrenID of that node.
func (*U64StringMatcher) MatchCode ¶
func (m *U64StringMatcher) MatchCode(id uint64) string
MatchCode returns the canonical Value for id, or "".
func (*U64StringMatcher) MatchID ¶
func (m *U64StringMatcher) MatchID(id uint64, key string) uint64
MatchID finds key in the subtree rooted at id (id itself + all descendants). id == 0 searches the whole forest. Returns 0 if missing / outside subtree.
func (*U64StringMatcher) ParentID ¶
func (m *U64StringMatcher) ParentID(id uint64) uint64
ParentID returns the parent of id (0 for roots / unknown).
func (*U64StringMatcher) Set ¶
func (m *U64StringMatcher) Set(parentID, id uint64, value string) *U64StringMatcher
Set registers or overwrites a node under parentID (0 = root).
func (*U64StringMatcher) SetNodes ¶
func (m *U64StringMatcher) SetNodes(nodes ...Node) *U64StringMatcher
SetNodes registers multiple nodes.