collections

package
v3.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Noop collection.Collection = &noop{}

Functions

This section is empty.

Types

type ConcatCollection

type ConcatCollection struct {
	// contains filtered or unexported fields
}

ConcatCollection is a collection view over multiple collections.

func NewConcatCollection

func NewConcatCollection(variable variables.RuleVariable, data ...collection.Collection) *ConcatCollection

func (*ConcatCollection) FindAll

func (c *ConcatCollection) FindAll() []types.MatchData

FindAll returns all matches for all collections

func (*ConcatCollection) Name

func (c *ConcatCollection) Name() string

Name returns the name for the current CollectionconcatCollection

type ConcatKeyed

type ConcatKeyed struct {
	// contains filtered or unexported fields
}

ConcatKeyed is a collection view over multiple keyed collections.

func NewConcatKeyed

func NewConcatKeyed(variable variables.RuleVariable, data ...collection.Keyed) *ConcatKeyed

func (*ConcatKeyed) FindAll

func (c *ConcatKeyed) FindAll() []types.MatchData

FindAll returns all matches for all collections

func (*ConcatKeyed) FindRegex

func (c *ConcatKeyed) FindRegex(key *regexp.Regexp) []types.MatchData

FindRegex returns a slice of MatchData for the regex

func (*ConcatKeyed) FindString

func (c *ConcatKeyed) FindString(key string) []types.MatchData

FindString returns a slice of MatchData for the string

func (*ConcatKeyed) Get

func (c *ConcatKeyed) Get(key string) []string

func (*ConcatKeyed) Name

func (c *ConcatKeyed) Name() string

Name returns the name for the current CollectionconcatCollection

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map is a default collection.Map.

func NewCaseSensitiveKeyMap

func NewCaseSensitiveKeyMap(variable variables.RuleVariable) *Map

NewCaseSensitiveKeyMap creates a new Map with case sensitive keys.

func NewMap

func NewMap(variable variables.RuleVariable) *Map

NewMap creates a new Map. By default, the Map key is case insensitive.

func (*Map) Add

func (c *Map) Add(key string, value string)

Add adds a new key-value pair to the map.

func (*Map) FindAll

func (c *Map) FindAll() []types.MatchData

FindAll returns all map elements.

func (*Map) FindRegex

func (c *Map) FindRegex(key *regexp.Regexp) []types.MatchData

FindRegex returns all map elements whose key matches the regular expression.

func (*Map) FindString

func (c *Map) FindString(key string) []types.MatchData

FindString returns all map elements whose key matches the string.

func (*Map) Format

func (c *Map) Format(res *strings.Builder)

Format updates the passed strings.Builder with the formatted map key/values.

func (*Map) Get

func (c *Map) Get(key string) []string

func (*Map) Len

func (c *Map) Len() int

Len returns the number of key/value pairs in the map.

func (*Map) Name

func (c *Map) Name() string

Name returns the name of the map/collection.

func (*Map) Remove

func (c *Map) Remove(key string)

Remove removes a key/value from the map.

func (*Map) Reset

func (c *Map) Reset()

Reset removes all key/value pairs from the map.

func (*Map) Set

func (c *Map) Set(key string, values []string)

Set sets the value of a key with the array of strings passed. If the key already exists, it will be overwritten.

func (*Map) SetIndex

func (c *Map) SetIndex(key string, index int, value string)

SetIndex sets the value of a key at the specified index. If the key already exists, it will be overwritten.

func (*Map) String

func (c *Map) String() string

String returns a string representation of the map key/values.

type NamedCollection

type NamedCollection struct {
	*Map
}

NamedCollection is a Collection that also keeps track of names.

func NewCaseSensitiveNamedCollection

func NewCaseSensitiveNamedCollection(rv variables.RuleVariable) *NamedCollection

func NewNamedCollection

func NewNamedCollection(rv variables.RuleVariable) *NamedCollection

func (*NamedCollection) Add

func (c *NamedCollection) Add(key string, value string)

Add a value to some key

func (*NamedCollection) Data

func (c *NamedCollection) Data() map[string][]string

Data is an internal method used for serializing to JSON

func (*NamedCollection) Format

func (c *NamedCollection) Format(res *strings.Builder)

func (*NamedCollection) Len

func (c *NamedCollection) Len() int

func (*NamedCollection) Name

func (c *NamedCollection) Name() string

Name returns the name for the current CollectionMap

func (*NamedCollection) Names

func (*NamedCollection) Remove

func (c *NamedCollection) Remove(key string)

Remove deletes the key from the CollectionMap

func (*NamedCollection) Reset

func (c *NamedCollection) Reset()

func (*NamedCollection) Set

func (c *NamedCollection) Set(key string, values []string)

Set will replace the key's value with this slice

func (*NamedCollection) SetIndex

func (c *NamedCollection) SetIndex(key string, index int, value string)

SetIndex will place the value under the index If the index is higher than the current size of the CollectionMap it will be appended

func (*NamedCollection) String

func (c *NamedCollection) String() string

type NamedCollectionNames

type NamedCollectionNames struct {
	// contains filtered or unexported fields
}

func (*NamedCollectionNames) FindAll

func (c *NamedCollectionNames) FindAll() []types.MatchData

func (*NamedCollectionNames) FindRegex

func (c *NamedCollectionNames) FindRegex(key *regexp.Regexp) []types.MatchData

func (*NamedCollectionNames) FindString

func (c *NamedCollectionNames) FindString(key string) []types.MatchData

func (*NamedCollectionNames) Name

func (c *NamedCollectionNames) Name() string

func (*NamedCollectionNames) String

func (c *NamedCollectionNames) String() string

type Single

type Single struct {
	// contains filtered or unexported fields
}

func NewSingle

func NewSingle(variable variables.RuleVariable) *Single

NewSingle creates a new Single.

func (*Single) FindAll

func (c *Single) FindAll() []types.MatchData

func (*Single) Format

func (c *Single) Format(res *strings.Builder)

func (*Single) Get

func (c *Single) Get() string

func (*Single) Name

func (c *Single) Name() string

func (*Single) Reset

func (c *Single) Reset()

func (*Single) Set

func (c *Single) Set(value string)

func (*Single) String

func (c *Single) String() string

type SizeCollection

type SizeCollection struct {
	// contains filtered or unexported fields
}

func NewSizeCollection

func NewSizeCollection(variable variables.RuleVariable, data ...*NamedCollection) *SizeCollection

NewSizeCollection returns a collection that only returns the total sum of all the collections values

func (*SizeCollection) FindAll

func (c *SizeCollection) FindAll() []types.MatchData

FindAll returns a slice of MatchData of all matches

func (*SizeCollection) FindRegex

func (c *SizeCollection) FindRegex(*regexp.Regexp) []types.MatchData

FindRegex returns a slice of MatchData for the regex

func (*SizeCollection) FindString

func (c *SizeCollection) FindString(string) []types.MatchData

FindString returns a slice of MatchData for the string

func (*SizeCollection) Format

func (c *SizeCollection) Format(res *strings.Builder)

func (*SizeCollection) Name

func (c *SizeCollection) Name() string

Name returns the name for the current CollectionSizeProxy

func (*SizeCollection) String

func (c *SizeCollection) String() string

Jump to

Keyboard shortcuts

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