collections

package
v3.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 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 NewMap

func NewMap(variable variables.RuleVariable) *Map

func (*Map) Add

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

func (*Map) FindAll

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

func (*Map) FindRegex

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

func (*Map) FindString

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

func (*Map) Format

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

func (*Map) Get

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

func (*Map) Len

func (c *Map) Len() int

func (*Map) Name

func (c *Map) Name() string

func (*Map) Remove

func (c *Map) Remove(key string)

func (*Map) Reset

func (c *Map) Reset()

func (*Map) Set

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

func (*Map) SetIndex

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

func (*Map) String

func (c *Map) String() string

type NamedCollection

type NamedCollection struct {
	*Map
}

NamedCollection is a Collection that also keeps track of names.

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