Documentation ¶
Index ¶
- Constants
- func BaseTypeToString(raw any) string
- func CompareItemsKeys(a, b any) int
- func CompareKeysInsensitive(a, b any) int
- func CompareString(a, b string) int
- func FindElement[T any](arr []T, predicate func(T) bool) *T
- func GetFiltered[T any](arr []T, predicate func(T) bool) []T
- func InArray[T comparable](val T, arr []T) bool
- type Collection
- func (c *Collection[T]) Add(item T)
- func (c *Collection[T]) Contains(i T) bool
- func (c *Collection[T]) ContainsKey(n string) bool
- func (c *Collection[T]) Get(key string) (noVal T)
- func (c *Collection[T]) Len() int
- func (c *Collection[T]) Less(i, j int) bool
- func (c *Collection[T]) Map() map[string]T
- func (c *Collection[T]) Remove(key string)
- func (c *Collection[T]) Slice() []T
- func (c *Collection[T]) Sort() ICollection[T]
- func (c *Collection[T]) Swap(i, j int)
- type CollectionItem
- type ComparableItem
- type ICollection
- type ItemWithKey
- type ItemWithName
Constants ¶
View Source
const ( Equal int = 0 LessThan int = -1 GreaterThan int = 1 )
Variables ¶
This section is empty.
Functions ¶
func BaseTypeToString ¶ added in v1.0.35
func CompareItemsKeys ¶ added in v1.0.32
func CompareKeysInsensitive ¶ added in v1.0.33
func CompareString ¶ added in v1.0.25
func FindElement ¶ added in v1.0.30
func GetFiltered ¶ added in v1.0.30
func InArray ¶ added in v1.0.30
func InArray[T comparable](val T, arr []T) bool
Types ¶
type Collection ¶
type Collection[T CollectionItem] struct { // contains filtered or unexported fields }
func NewCollection ¶
func NewCollection[T CollectionItem](items ...T) *Collection[T]
func (*Collection[T]) Add ¶
func (c *Collection[T]) Add(item T)
func (*Collection[T]) Contains ¶
func (c *Collection[T]) Contains(i T) bool
func (*Collection[T]) ContainsKey ¶
func (c *Collection[T]) ContainsKey(n string) bool
func (*Collection[T]) Get ¶
func (c *Collection[T]) Get(key string) (noVal T)
func (*Collection[T]) Len ¶ added in v1.0.28
func (c *Collection[T]) Len() int
func (*Collection[T]) Less ¶ added in v1.0.28
func (c *Collection[T]) Less(i, j int) bool
func (*Collection[T]) Map ¶ added in v1.0.24
func (c *Collection[T]) Map() map[string]T
func (*Collection[T]) Remove ¶
func (c *Collection[T]) Remove(key string)
func (*Collection[T]) Slice ¶ added in v1.0.24
func (c *Collection[T]) Slice() []T
func (*Collection[T]) Sort ¶
func (c *Collection[T]) Sort() ICollection[T]
func (*Collection[T]) Swap ¶ added in v1.0.28
func (c *Collection[T]) Swap(i, j int)
type CollectionItem ¶
type CollectionItem interface { ItemWithKey ComparableItem }
type ComparableItem ¶ added in v1.0.26
type ICollection ¶ added in v1.0.28
type ICollection[T CollectionItem] interface { sort.Interface Add(item T) Get(k string) T Remove(k string) Contains(i T) bool ContainsKey(k string) bool Sort() ICollection[T] Slice() []T Map() map[string]T }
type ItemWithKey ¶ added in v1.0.26
type ItemWithName ¶ added in v1.0.26
type ItemWithName interface {
Name() string
}
Click to show internal directories.
Click to hide internal directories.