Documentation
¶
Overview ¶
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. * SPDX-License-Identifier: Apache-2.0
Index ¶
- func All(slice []bool) bool
- func AllFunc[S ~[]E, E any](s S, f func(E) bool) bool
- func AllNotEmpty(strict bool, slice []string) bool
- func AllTrue(values ...bool) bool
- func And(values ...bool) bool
- func Any(slice []bool) bool
- func AnyEmpty(strict bool, slice []string) bool
- func AnyFunc[S ~[]E, E any](s S, f func(E) bool) bool
- func AnyTrue(values ...bool) bool
- func Find(slice *[]string, val string) (int, bool)
- func FindInSlice(strict bool, slice []string, val ...string) (int, bool)
- func GenericRemove(equal func(string, string) bool, slice []string, val ...string) []string
- func Negate(values ...bool) []bool
- func OneHot(values ...bool) bool
- func Or(values ...bool) bool
- func ParseCommaSeparatedList(input string) []string
- func ParseCommaSeparatedListToMap(input string) (pairs map[string]string, err error)
- func ParseListWithCleanup(input string, sep string) (newS []string)
- func ParseListWithCleanupKeepBlankLines(input string, sep string) (newS []string)
- func Remove(slice []string, val ...string) []string
- func UniqueEntries[T comparable](slice []T) []T
- func Xor(values ...bool) bool
- type Conditions
- func (c *Conditions) Add(conditions ...bool) Conditions
- func (c *Conditions) All() bool
- func (c *Conditions) And() bool
- func (c *Conditions) Any() bool
- func (c *Conditions) Concat(more *Conditions) Conditions
- func (c *Conditions) Contains(condition bool) bool
- func (c *Conditions) ForEach(each func(bool) error) error
- func (c *Conditions) Negate() Conditions
- func (c *Conditions) OneHot() bool
- func (c *Conditions) Or() bool
- func (c *Conditions) Xor() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllFunc ¶ added in v1.78.0
AllFunc returns whether f returns true for all the elements of slice s.
func AllNotEmpty ¶ added in v1.49.0
AllNotEmpty returns whether all elements of the slice are not empty. If strict, then whitespaces are considered as empty strings
func AnyEmpty ¶ added in v1.49.0
AnyEmpty returns whether there is one entry in the slice which is empty. If strict, then whitespaces are considered as empty strings
func AnyFunc ¶ added in v1.78.0
AnyFunc returns whether there is at least one element of slice s for which f() returns true.
func Find ¶
Find looks for an element in a slice. If found it will return its index and true; otherwise it will return -1 and false.
func FindInSlice ¶ added in v1.49.0
FindInSlice finds if any values val are present in the slice and if so returns the first index. if strict, it checks for an exact match; otherwise it discards whitespaces and case.
func GenericRemove ¶ added in v1.4.0
GenericRemove looks for elements in a slice using the equal function. If they're found, it will remove them from the slice.
func OneHot ¶ added in v1.80.0
OneHot returns true if one, and only one, of the supplied values is true. See https://en.wikipedia.org/wiki/One-hot
func ParseCommaSeparatedList ¶
ParseCommaSeparatedList returns the list of string separated by a comma
func ParseCommaSeparatedListToMap ¶ added in v1.71.0
ParseCommaSeparatedListToMap returns a map of key value pairs from a string containing a comma separated list
func ParseListWithCleanup ¶ added in v1.9.0
ParseListWithCleanup splits a string into a list like strings.Split but also removes any whitespace surrounding the different items for example, ParseListWithCleanup("a, b , c", ",") returns []{"a","b","c"}
func ParseListWithCleanupKeepBlankLines ¶ added in v1.12.0
ParseListWithCleanupKeepBlankLines splits a string into a list like strings.Split but also removes any whitespace surrounding the different items unless the entire item is whitespace in which case it is converted to an empty string. For example, ParseListWithCleanupKeepBlankLines("a, b , c", ",") returns []{"a","b","c"} ParseListWithCleanupKeepBlankLines("a, b , , c", ",") returns []{"a","b", "", "c"}
func Remove ¶ added in v1.4.0
Remove looks for elements in a slice. If they're found, it will remove them.
func UniqueEntries ¶ added in v1.75.0
func UniqueEntries[T comparable](slice []T) []T
UniqueEntries returns all the unique values contained in a slice.
Types ¶
type Conditions ¶ added in v1.80.0
type Conditions []bool
func NewConditions ¶ added in v1.80.0
func NewConditions(capacity int) Conditions
NewConditions creates a set of conditions.
func NewConditionsFromValues ¶ added in v1.80.0
func NewConditionsFromValues(conditions ...bool) Conditions
NewConditionsFromValues creates a set of conditions.
func (*Conditions) Add ¶ added in v1.80.0
func (c *Conditions) Add(conditions ...bool) Conditions
Add adds conditions and returns itself.
func (*Conditions) All ¶ added in v1.80.0
func (c *Conditions) All() bool
All returns true if all conditions are true.
func (*Conditions) And ¶ added in v1.80.0
func (c *Conditions) And() bool
And performs an `and` operation on all conditions
func (*Conditions) Any ¶ added in v1.80.0
func (c *Conditions) Any() bool
Any returns true if there is at least one condition which is true.
func (*Conditions) Concat ¶ added in v1.80.0
func (c *Conditions) Concat(more *Conditions) Conditions
Concat concatenates conditions and returns itself.
func (*Conditions) Contains ¶ added in v1.80.0
func (c *Conditions) Contains(condition bool) bool
Contains returns whether the conditions collection contains the value of a condition.
func (*Conditions) ForEach ¶ added in v1.80.0
func (c *Conditions) ForEach(each func(bool) error) error
ForEach will execute function each() on every condition unless an error is returned and will end add this point.
func (*Conditions) Negate ¶ added in v1.80.0
func (c *Conditions) Negate() Conditions
Negate returns a new set of conditions with negated values.
func (*Conditions) OneHot ¶ added in v1.80.0
func (c *Conditions) OneHot() bool
OneHot performs an `OnHot` operation on all conditions
func (*Conditions) Or ¶ added in v1.80.0
func (c *Conditions) Or() bool
Or performs an `Or` operation on all conditions
func (*Conditions) Xor ¶ added in v1.80.0
func (c *Conditions) Xor() bool
Xor performs a `Xor` operation on all conditions
Directories
¶
Path | Synopsis |
---|---|
Package pagination provides a ways to iterate over collections.
|
Package pagination provides a ways to iterate over collections. |