sliceof

package
v0.25.28 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Any

type Any []any

func NewAny added in v0.11.0

func NewAny(values ...any) Any

func (*Any) Append added in v0.12.0

func (x *Any) Append(values ...any)

Append adds one or more elements to the end of the slice

func (Any) At added in v0.21.5

func (x Any) At(index int) any

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (Any) Contains added in v0.21.4

func (x Any) Contains(value any) bool

Contains returns TRUE if the slice contains the specified value

func (Any) ContainsAll added in v0.21.4

func (x Any) ContainsAll(values ...any) bool

ContainsAll returns TRUE if the slice contains all of the specified values

func (Any) ContainsAny added in v0.21.4

func (x Any) ContainsAny(values ...any) bool

ContainsAny returns TRUE if the slice contains any of the specified values

func (Any) ContainsInterface added in v0.25.9

func (x Any) ContainsInterface(value any) bool

ContainsInterface returns TRUE if the provided generic value is contained in the slice.

func (Any) Equal added in v0.21.4

func (x Any) Equal(value []any) bool

Equal returns TRUE if the slice contains exactly the same elements as the specified value

func (Any) Filter added in v0.25.27

func (x Any) Filter(fn func(any) bool) Any

Filter returns all elements in the slice that satisfies the provided function.

func (Any) Find added in v0.23.0

func (x Any) Find(fn func(any) bool) (any, bool)

Find returns the first element in the slice that satisfies the provided function.

func (Any) First added in v0.10.0

func (x Any) First() any

First returns the first element in the slice, or nil if the slice is empty

func (Any) FirstN added in v0.21.4

func (x Any) FirstN(n int) Any

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (Any) GetAny

func (x Any) GetAny(key string) any

func (Any) GetAnyOK added in v0.10.0

func (x Any) GetAnyOK(key string) (any, bool)

func (Any) GetBool

func (x Any) GetBool(key string) bool

func (Any) GetBoolOK added in v0.11.0

func (x Any) GetBoolOK(key string) (bool, bool)

func (Any) GetFloat

func (x Any) GetFloat(key string) float64

func (Any) GetFloatOK added in v0.10.0

func (x Any) GetFloatOK(key string) (float64, bool)

func (Any) GetIndex added in v0.22.0

func (x Any) GetIndex(index int) (any, bool)

func (Any) GetInt

func (x Any) GetInt(key string) int

func (Any) GetInt64

func (x Any) GetInt64(key string) int64

func (Any) GetInt64OK added in v0.11.0

func (x Any) GetInt64OK(key string) (int64, bool)

func (Any) GetIntOK added in v0.11.0

func (x Any) GetIntOK(key string) (int, bool)

func (*Any) GetPointer added in v0.14.0

func (x *Any) GetPointer(key string) (any, bool)

func (Any) GetString

func (x Any) GetString(key string) string

func (Any) GetStringOK added in v0.11.0

func (x Any) GetStringOK(key string) (string, bool)

func (Any) GroupBy added in v0.25.20

func (x Any) GroupBy(field string) AnyGrouper

func (Any) IsEmpty added in v0.10.0

func (x Any) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (Any) IsLength added in v0.10.0

func (x Any) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (Any) IsZero added in v0.25.22

func (x Any) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (Any) Keys added in v0.22.0

func (x Any) Keys() []string

Keys returns a slice of strings representing the indexes of this slice

func (Any) Last added in v0.10.0

func (x Any) Last() any

Last returns the last element in the slice, or nil if the slice is empty

func (Any) Length added in v0.10.0

func (x Any) Length() int

Length returns the number of elements in the slice

func (Any) NotEmpty added in v0.16.3

func (x Any) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (Any) Range added in v0.25.11

func (x Any) Range() iter.Seq2[int, any]

Range returns an iterator that yields each value in this slice.

func (*Any) Remove added in v0.10.0

func (x *Any) Remove(key string) bool

Remove removes the element with the specified key

func (*Any) RemoveAt added in v0.25.12

func (x *Any) RemoveAt(index int) bool

RemoveAt removes the element at the specified index

func (Any) Reverse added in v0.10.0

func (x Any) Reverse() Any

Reverse returns a new slice with the elements in reverse order

func (*Any) SetAny

func (x *Any) SetAny(key string, value any) bool

func (*Any) SetBool

func (x *Any) SetBool(key string, value bool) bool

func (*Any) SetFloat

func (x *Any) SetFloat(key string, value float64) bool

SetFloat sets a property with a float64 value

func (*Any) SetIndex added in v0.24.0

func (x *Any) SetIndex(index int, value any) bool

func (*Any) SetInt

func (x *Any) SetInt(key string, value int) bool

SetInt sets a property with an int value

func (*Any) SetInt64

func (x *Any) SetInt64(key string, value int64) bool

SetInt64 sets a property with an int64 value

func (*Any) SetString

func (x *Any) SetString(key string, value string) bool

SetString sets a property with an string value

func (*Any) SetValue added in v0.10.0

func (x *Any) SetValue(value any) error

SetValue sets the entire value of this slice to the provided value

func (Any) Shuffle added in v0.21.4

func (x Any) Shuffle() Any

Shuffle randomizes the order of the elements in the slice

type AnyGrouper added in v0.25.20

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

func (AnyGrouper) IsFooter added in v0.25.20

func (grouper AnyGrouper) IsFooter(index int) bool

func (AnyGrouper) IsHeader added in v0.25.20

func (grouper AnyGrouper) IsHeader(index int) bool

type Float

type Float []float64

func NewFloat added in v0.11.0

func NewFloat(values ...float64) Float

func (*Float) Append added in v0.12.0

func (x *Float) Append(values ...float64)

Append adds one or more elements to the end of the slice

func (Float) At added in v0.21.5

func (x Float) At(index int) float64

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (Float) Contains added in v0.11.2

func (x Float) Contains(value float64) bool

Contains returns TRUE if the slice contains the specified value

func (Float) ContainsAll added in v0.14.0

func (x Float) ContainsAll(values ...float64) bool

ContainsAll returns TRUE if the slice contains all of the specified values

func (Float) ContainsAny added in v0.14.0

func (x Float) ContainsAny(values ...float64) bool

ContainsAny returns TRUE if the slice contains any of the specified values

func (Float) ContainsFloaterface added in v0.25.21

func (x Float) ContainsFloaterface(value any) bool

ContainsFloaterface returns TRUE if the provided generic value is contained in the slice.

func (Float) Equal added in v0.11.2

func (x Float) Equal(value []float64) bool

Equal returns TRUE if the slice contains exactly the same elements as the "value" slice

func (Float) Filter added in v0.25.27

func (x Float) Filter(fn func(float64) bool) Float

Filter returns all elements in the slice that satisfies the provided function.

func (Float) Find added in v0.25.21

func (x Float) Find(fn func(float64) bool) (float64, bool)

Find returns the first element in the slice that satisfies the provided function.

func (Float) First added in v0.10.0

func (x Float) First() float64

First returns the first element in the slice, or nil if the slice is empty

func (Float) FirstN added in v0.21.4

func (x Float) FirstN(n int) Float

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (Float) GetAny added in v0.25.21

func (x Float) GetAny(key string) any

GetAny returns the rquested property as an any type

func (Float) GetAnyOK added in v0.25.21

func (x Float) GetAnyOK(key string) (any, bool)

GetAnyOK returns the requested property as an any type and a boolean TRUE/FALSE value indicating whether the value was found

func (Float) GetFloat

func (x Float) GetFloat(key string) float64

GetFloat returns the requested property as a float64 type

func (Float) GetFloatOK added in v0.10.0

func (x Float) GetFloatOK(key string) (float64, bool)

GetFloatOK returns the requested property as a float64 type and a boolean TRUE/FALSE value indicating whether the value was found

func (Float) IsEmpty added in v0.10.0

func (x Float) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (Float) IsLength added in v0.10.0

func (x Float) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (Float) IsZero added in v0.25.22

func (x Float) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (Float) Keys added in v0.25.21

func (x Float) Keys() []string

Keys returns a slice of float64s representing the indexes of this slice

func (Float) Last added in v0.10.0

func (x Float) Last() float64

Last returns the last element in the slice, or nil if the slice is empty

func (Float) Length added in v0.10.0

func (x Float) Length() int

Length returns the number of elements in the slice

func (Float) NotContains added in v0.25.21

func (x Float) NotContains(value float64) bool

func (Float) NotEmpty added in v0.16.3

func (x Float) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (Float) NotEqual added in v0.25.21

func (x Float) NotEqual(value []float64) bool

NotEqual returns TRUE if the slice DOES NOT contain exactly the same elements as the "value" slice

func (Float) Range added in v0.25.21

func (x Float) Range() iter.Seq2[int, float64]

Range returns an iterator that yields each value in this slice.

func (*Float) Remove added in v0.10.0

func (s *Float) Remove(key string) bool

Remove deletes the element at the specified key

func (*Float) RemoveAt added in v0.25.21

func (x *Float) RemoveAt(index int) bool

RemoveAt deletes the element at the specified index

func (Float) Reverse added in v0.10.0

func (x Float) Reverse() Float

Reverse modifies the slice with the elements in reverse order

func (*Float) SetFloat

func (s *Float) SetFloat(key string, value float64) bool

SetFloat sets the value at the specified key, growing the slice if necessary

func (*Float) SetIndex added in v0.25.21

func (s *Float) SetIndex(index int, value any) bool

SetIndex sets the value at the specified index, growing the slice if necessary

func (*Float) SetValue added in v0.10.0

func (s *Float) SetValue(value any) error

SetValue sets the value at the specified index, growing the slice if necessary

func (Float) Shuffle added in v0.21.4

func (x Float) Shuffle() Float

Shuffle randomizes the order of the elements in the slice

type Int

type Int []int

func NewInt added in v0.11.0

func NewInt(values ...int) Int

func (*Int) Append added in v0.12.0

func (x *Int) Append(values ...int)

Append adds one or more elements to the end of the slice

func (Int) At added in v0.21.5

func (x Int) At(index int) int

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (Int) Contains added in v0.11.2

func (x Int) Contains(value int) bool

Contains returns TRUE if the slice contains the specified value

func (Int) ContainsAll added in v0.14.0

func (x Int) ContainsAll(values ...int) bool

ContainsAll returns TRUE if the slice contains all of the specified values

func (Int) ContainsAny added in v0.14.0

func (x Int) ContainsAny(values ...int) bool

ContainsAny returns TRUE if the slice contains any of the specified values

func (Int) ContainsInterface added in v0.25.9

func (x Int) ContainsInterface(value any) bool

ContainsInterface returns TRUE if the provided generic value is contained in the slice.

func (Int) Equal added in v0.11.2

func (x Int) Equal(value []int) bool

Equal returns TRUE if the slice contains exactly the same elements as the "value" slice

func (Int) Filter added in v0.25.27

func (x Int) Filter(fn func(int) bool) Int

Filter returns all elements in the slice that satisfies the provided function.

func (Int) Find added in v0.25.8

func (x Int) Find(fn func(int) bool) (int, bool)

Find returns the first element in the slice that satisfies the provided function.

func (Int) First added in v0.10.0

func (x Int) First() int

First returns the first element in the slice, or nil if the slice is empty

func (Int) FirstN added in v0.21.4

func (x Int) FirstN(n int) Int

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (Int) GetAny added in v0.25.8

func (x Int) GetAny(key string) any

func (Int) GetAnyOK added in v0.25.8

func (x Int) GetAnyOK(key string) (any, bool)

func (Int) GetInt

func (x Int) GetInt(key string) int

func (Int) GetIntOK added in v0.11.0

func (x Int) GetIntOK(key string) (int, bool)

func (Int) IsEmpty added in v0.10.0

func (x Int) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (Int) IsLength added in v0.10.0

func (x Int) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (Int) IsZero added in v0.25.22

func (x Int) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (Int) Keys added in v0.25.8

func (x Int) Keys() []string

Keys returns a slice of ints representing the indexes of this slice

func (Int) Last added in v0.10.0

func (x Int) Last() int

Last returns the last element in the slice, or nil if the slice is empty

func (Int) Length added in v0.10.0

func (x Int) Length() int

Length returns the number of elements in the slice

func (Int) NotContains added in v0.25.8

func (x Int) NotContains(value int) bool

func (Int) NotEmpty added in v0.16.3

func (x Int) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (Int) NotEqual added in v0.25.8

func (x Int) NotEqual(value []int) bool

NotEqual returns TRUE if the slice DOES NOT contain exactly the same elements as the "value" slice

func (Int) Range added in v0.25.11

func (x Int) Range() iter.Seq2[int, int]

Range returns an iterator that yields each value in this slice.

func (*Int) Remove added in v0.10.0

func (s *Int) Remove(key string) bool

func (*Int) RemoveAt added in v0.25.12

func (x *Int) RemoveAt(index int) bool

func (Int) Reverse added in v0.10.0

func (x Int) Reverse() Int

Reverse modifies the slice with the elements in reverse order

func (*Int) SetIndex added in v0.25.8

func (s *Int) SetIndex(index int, value any) bool

func (*Int) SetInt

func (s *Int) SetInt(key string, value int) bool

func (*Int) SetValue added in v0.10.0

func (s *Int) SetValue(value any) error

func (Int) Shuffle added in v0.21.4

func (x Int) Shuffle() Int

Shuffle randomizes the order of the elements in the slice

type MapOfAny added in v0.25.24

type MapOfAny []mapof.Any

func NewMapOfAny added in v0.25.24

func NewMapOfAny(values ...mapof.Any) MapOfAny

func (*MapOfAny) Append added in v0.25.24

func (x *MapOfAny) Append(values ...mapof.Any)

Append adds one or more elements to the end of the slice

func (MapOfAny) At added in v0.25.24

func (x MapOfAny) At(index int) mapof.Any

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (MapOfAny) AtOK added in v0.25.24

func (x MapOfAny) AtOK(index int) (mapof.Any, bool)

func (MapOfAny) Contains added in v0.25.24

func (x MapOfAny) Contains(match func(mapof.Any) bool) bool

Contains returns TRUE if the "match" function returns TRUE for any element in the slice

func (MapOfAny) Filter added in v0.25.27

func (x MapOfAny) Filter(fn func(mapof.Any) bool) MapOfAny

Filter returns all elements in the slice that satisfies the provided function.

func (MapOfAny) Find added in v0.25.24

func (x MapOfAny) Find(fn func(mapof.Any) bool) (mapof.Any, bool)

Find returns the first element in the slice that satisfies the provided function.

func (MapOfAny) First added in v0.25.24

func (x MapOfAny) First() mapof.Any

First returns the first element in the slice, or nil if the slice is empty

func (MapOfAny) FirstN added in v0.25.24

func (x MapOfAny) FirstN(n int) MapOfAny

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (MapOfAny) GetAny added in v0.25.24

func (x MapOfAny) GetAny(key string) any

func (MapOfAny) GetAnyOK added in v0.25.24

func (x MapOfAny) GetAnyOK(key string) (any, bool)

func (*MapOfAny) GetPointer added in v0.25.24

func (x *MapOfAny) GetPointer(name string) (any, bool)

func (MapOfAny) GroupBy added in v0.25.24

func (x MapOfAny) GroupBy(field string) MapOfAnyGrouper

func (MapOfAny) IsEmpty added in v0.25.24

func (x MapOfAny) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (MapOfAny) IsLength added in v0.25.24

func (x MapOfAny) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (MapOfAny) IsZero added in v0.25.24

func (x MapOfAny) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (MapOfAny) Keys added in v0.25.24

func (x MapOfAny) Keys() []string

Keys returns a slice of strings representing the indexes of this slice

func (MapOfAny) Last added in v0.25.24

func (x MapOfAny) Last() mapof.Any

Last returns the last element in the slice, or nil if the slice is empty

func (MapOfAny) Length added in v0.25.24

func (x MapOfAny) Length() int

Length returns the number of elements in the slice

func (MapOfAny) NotEmpty added in v0.25.24

func (x MapOfAny) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (MapOfAny) Range added in v0.25.24

func (x MapOfAny) Range() iter.Seq2[int, mapof.Any]

Range returns an iterator that yields each value in this slice.

func (*MapOfAny) Remove added in v0.25.24

func (x *MapOfAny) Remove(key string) bool

func (*MapOfAny) RemoveAt added in v0.25.24

func (x *MapOfAny) RemoveAt(index int) bool

func (MapOfAny) Reverse added in v0.25.24

func (x MapOfAny) Reverse() MapOfAny

Reverse returns a new slice with the elements in reverse order

func (*MapOfAny) SetIndex added in v0.25.24

func (s *MapOfAny) SetIndex(index int, value any) bool

func (*MapOfAny) SetValue added in v0.25.24

func (s *MapOfAny) SetValue(value any) error

func (MapOfAny) Shuffle added in v0.25.24

func (x MapOfAny) Shuffle() MapOfAny

Shuffle randomizes the order of the elements in the slice

type MapOfAnyGrouper added in v0.25.24

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

func (MapOfAnyGrouper) IsFooter added in v0.25.24

func (grouper MapOfAnyGrouper) IsFooter(index int) bool

func (MapOfAnyGrouper) IsHeader added in v0.25.24

func (grouper MapOfAnyGrouper) IsHeader(index int) bool

type MapOfString added in v0.25.24

type MapOfString []mapof.String

func NewMapOfString added in v0.25.24

func NewMapOfString(values ...mapof.String) MapOfString

func (*MapOfString) Append added in v0.25.24

func (x *MapOfString) Append(values ...mapof.String)

Append adds one or more elements to the end of the slice

func (MapOfString) At added in v0.25.24

func (x MapOfString) At(index int) mapof.String

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (MapOfString) AtOK added in v0.25.24

func (x MapOfString) AtOK(index int) (mapof.String, bool)

func (MapOfString) Contains added in v0.25.24

func (x MapOfString) Contains(match func(mapof.String) bool) bool

Contains returns TRUE if the "match" function returns TRUE for any element in the slice

func (MapOfString) Filter added in v0.25.27

func (x MapOfString) Filter(fn func(mapof.String) bool) MapOfString

Filter returns all elements in the slice that satisfies the provided function.

func (MapOfString) Find added in v0.25.24

func (x MapOfString) Find(fn func(mapof.String) bool) (mapof.String, bool)

Find returns the first element in the slice that satisfies the provided function.

func (MapOfString) First added in v0.25.24

func (x MapOfString) First() mapof.String

First returns the first element in the slice, or nil if the slice is empty

func (MapOfString) FirstN added in v0.25.24

func (x MapOfString) FirstN(n int) MapOfString

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (MapOfString) GetAny added in v0.25.24

func (x MapOfString) GetAny(key string) any

func (MapOfString) GetAnyOK added in v0.25.24

func (x MapOfString) GetAnyOK(key string) (any, bool)

func (*MapOfString) GetPointer added in v0.25.24

func (x *MapOfString) GetPointer(name string) (any, bool)

func (MapOfString) GroupBy added in v0.25.24

func (x MapOfString) GroupBy(field string) MapOfStringGrouper

func (MapOfString) IsEmpty added in v0.25.24

func (x MapOfString) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (MapOfString) IsLength added in v0.25.24

func (x MapOfString) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (MapOfString) IsZero added in v0.25.24

func (x MapOfString) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (MapOfString) Keys added in v0.25.24

func (x MapOfString) Keys() []string

Keys returns a slice of strings representing the indexes of this slice

func (MapOfString) Last added in v0.25.24

func (x MapOfString) Last() mapof.String

Last returns the last element in the slice, or nil if the slice is empty

func (MapOfString) Length added in v0.25.24

func (x MapOfString) Length() int

Length returns the number of elements in the slice

func (MapOfString) NotEmpty added in v0.25.24

func (x MapOfString) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (MapOfString) Range added in v0.25.24

func (x MapOfString) Range() iter.Seq2[int, mapof.String]

Range returns an iterator that yields each value in this slice.

func (*MapOfString) Remove added in v0.25.24

func (x *MapOfString) Remove(key string) bool

func (*MapOfString) RemoveAt added in v0.25.24

func (x *MapOfString) RemoveAt(index int) bool

func (MapOfString) Reverse added in v0.25.24

func (x MapOfString) Reverse() MapOfString

Reverse returns a new slice with the elements in reverse order

func (*MapOfString) SetIndex added in v0.25.24

func (s *MapOfString) SetIndex(index int, value any) bool

func (*MapOfString) SetValue added in v0.25.24

func (s *MapOfString) SetValue(value any) error

func (MapOfString) Shuffle added in v0.25.24

func (x MapOfString) Shuffle() MapOfString

Shuffle randomizes the order of the elements in the slice

type MapOfStringGrouper added in v0.25.24

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

func (MapOfStringGrouper) IsFooter added in v0.25.24

func (grouper MapOfStringGrouper) IsFooter(index int) bool

func (MapOfStringGrouper) IsHeader added in v0.25.24

func (grouper MapOfStringGrouper) IsHeader(index int) bool

type Object added in v0.10.0

type Object[T any] []T

func NewObject added in v0.11.0

func NewObject[T any](values ...T) Object[T]

func (*Object[T]) Append added in v0.12.0

func (x *Object[T]) Append(values ...T)

Append adds one or more elements to the end of the slice

func (Object[T]) At added in v0.21.5

func (x Object[T]) At(index int) T

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (Object[T]) AtOK added in v0.22.0

func (x Object[T]) AtOK(index int) (T, bool)

func (Object[T]) Contains added in v0.24.4

func (x Object[T]) Contains(match func(T) bool) bool

Contains returns TRUE if the "match" function returns TRUE for any element in the slice

func (Object[T]) Filter added in v0.25.27

func (x Object[T]) Filter(fn func(T) bool) Object[T]

Filter returns all elements in the slice that satisfies the provided function.

func (Object[T]) Find added in v0.23.0

func (x Object[T]) Find(fn func(T) bool) (T, bool)

Find returns the first element in the slice that satisfies the provided function.

func (Object[T]) First added in v0.10.0

func (x Object[T]) First() T

First returns the first element in the slice, or nil if the slice is empty

func (Object[T]) FirstN added in v0.21.4

func (x Object[T]) FirstN(n int) Object[T]

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (Object[T]) GetAny added in v0.22.0

func (x Object[T]) GetAny(key string) any

func (Object[T]) GetAnyOK added in v0.22.0

func (x Object[T]) GetAnyOK(key string) (any, bool)

func (*Object[T]) GetPointer added in v0.14.0

func (x *Object[T]) GetPointer(name string) (any, bool)

func (Object[T]) GroupBy added in v0.25.20

func (x Object[T]) GroupBy(field string) ObjectGrouper[T]

GroupBy returns an Grouper object for this slice

func (Object[T]) IsEmpty added in v0.10.0

func (x Object[T]) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (Object[T]) IsLength added in v0.10.0

func (x Object[T]) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (Object[T]) IsZero added in v0.25.22

func (x Object[T]) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (Object[T]) Keys added in v0.22.0

func (x Object[T]) Keys() []string

Keys returns a slice of strings representing the indexes of this slice

func (Object[T]) Last added in v0.10.0

func (x Object[T]) Last() T

Last returns the last element in the slice, or nil if the slice is empty

func (Object[T]) Length added in v0.10.0

func (x Object[T]) Length() int

Length returns the number of elements in the slice

func (Object[T]) NotEmpty added in v0.16.3

func (x Object[T]) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (Object[T]) Range added in v0.25.11

func (x Object[T]) Range() iter.Seq2[int, T]

Range returns an iterator that yields each value in this slice.

func (*Object[T]) Remove added in v0.10.0

func (x *Object[T]) Remove(key string) bool

func (*Object[T]) RemoveAt added in v0.25.12

func (x *Object[T]) RemoveAt(index int) bool

func (Object[T]) Reverse added in v0.10.0

func (x Object[T]) Reverse() Object[T]

Reverse returns a new slice with the elements in reverse order

func (*Object[T]) SetIndex added in v0.24.0

func (s *Object[T]) SetIndex(index int, value any) bool

func (*Object[T]) SetValue added in v0.22.1

func (s *Object[T]) SetValue(value any) error

func (Object[T]) Shuffle added in v0.21.4

func (x Object[T]) Shuffle() Object[T]

Shuffle randomizes the order of the elements in the slice

type ObjectGrouper added in v0.25.20

type ObjectGrouper[T any] struct {
	// contains filtered or unexported fields
}

ObjectGrouper calculates group headers and footers for a sliceof.Object

func (ObjectGrouper[T]) IsFooter added in v0.25.20

func (grouper ObjectGrouper[T]) IsFooter(index int) bool

IsFooter returns TRUE if the record at the given index is the LAST item in a group

func (ObjectGrouper[T]) IsHeader added in v0.25.20

func (grouper ObjectGrouper[T]) IsHeader(index int) bool

IsHeader returns TRUE if the record at the given index is the FIRST item in a group.

type String

type String []string

func NewString added in v0.11.0

func NewString(values ...string) String

func (*String) Append added in v0.12.0

func (x *String) Append(values ...string)

Append adds one or more elements to the end of the slice

func (String) At added in v0.21.5

func (x String) At(index int) string

At returns a bound-safe element from the slice. If the index is out of bounds, then `At` returns the zero value for the slice type

func (String) Contains added in v0.11.2

func (x String) Contains(value string) bool

Contains returns TRUE if the slice contains the specified value

func (String) ContainsAll added in v0.14.0

func (x String) ContainsAll(values ...string) bool

ContainsAll returns TRUE if the slice contains all of the specified values

func (String) ContainsAny added in v0.14.0

func (x String) ContainsAny(values ...string) bool

ContainsAny returns TRUE if the slice contains any of the specified values

func (String) ContainsInterface added in v0.25.9

func (x String) ContainsInterface(value any) bool

ContainsInterface returns TRUE if the provided generic value is contained in the slice.

func (String) Equal added in v0.11.2

func (x String) Equal(value []string) bool

Equal returns TRUE if the slice contains exactly the same elements as the "value" slice

func (String) Find added in v0.23.0

func (x String) Find(fn func(string) bool) (string, bool)

Find returns the first element in the slice that satisfies the provided function.

func (String) First added in v0.10.0

func (x String) First() string

First returns the first element in the slice, or nil if the slice is empty

func (String) FirstN added in v0.21.5

func (x String) FirstN(n int) String

FirstN returns the first "n" elements in the slice, or all elements if "n" is greater than the length of the slice

func (String) GetAny added in v0.22.0

func (x String) GetAny(key string) any

GetAny returns the value at the specified key as an "any" type

func (String) GetAnyOK added in v0.22.0

func (x String) GetAnyOK(key string) (any, bool)

GetAnyOK returns the value at the specified key as an "any" type, along with a boolean indicating success

func (String) GetString

func (x String) GetString(key string) string

GetString returns the string value at the specified key

func (String) GetStringOK added in v0.11.0

func (x String) GetStringOK(key string) (string, bool)

GetStringOK returns the string value at the specified key, along with a boolean indicating success

func (String) IsEmpty added in v0.10.0

func (x String) IsEmpty() bool

IsEmpty returns TRUE if the slice contains no elements

func (String) IsLength added in v0.10.0

func (x String) IsLength(length int) bool

IsLength returns TRUE if the slice contains exactly "length" elements

func (String) IsZero added in v0.25.22

func (x String) IsZero() bool

IsZero returns TRUE if the slice contains no elements. This is an alias for IsEmpty, and implements the `Zeroer` interface used by many packages (including go/json)

func (String) Join added in v0.19.1

func (x String) Join(delimiter string) string

Join concatenates all elements of the slice into a single string, separated by the specified delimiter

func (String) Keys added in v0.22.0

func (x String) Keys() []string

Keys returns a slice of strings representing the indexes of this slice

func (String) Last added in v0.10.0

func (x String) Last() string

Last returns the last element in the slice, or nil if the slice is empty

func (String) Length added in v0.10.0

func (x String) Length() int

Length returns the number of elements in the slice

func (String) NotContains added in v0.25.8

func (x String) NotContains(value string) bool

func (String) NotEmpty added in v0.16.3

func (x String) NotEmpty() bool

NotEmpty returns TRUE if the slice contains at least one element

func (String) NotEqual added in v0.24.8

func (x String) NotEqual(value []string) bool

NotEqual returns TRUE if the slice DOES NOT contain exactly the same elements as the "value" slice

func (String) Range added in v0.25.11

func (x String) Range() iter.Seq2[int, string]

Range returns an iterator that yields each value in this slice.

func (*String) Remove added in v0.10.0

func (x *String) Remove(key string) bool

Remove removes the element with the specified key

func (*String) RemoveAt added in v0.25.12

func (x *String) RemoveAt(index int) bool

RemoveAt removes the element at the specified index

func (String) Reverse added in v0.10.0

func (x String) Reverse() String

Reverse modifies the slice with the elements in reverse order

func (*String) SetIndex added in v0.24.0

func (x *String) SetIndex(index int, value any) bool

SetIndex sets the value at the specified index

func (*String) SetString

func (x *String) SetString(key string, value string) bool

SetString sets the string value at the specified key

func (*String) SetValue added in v0.10.0

func (x *String) SetValue(value any) error

SetValue sets the value of this slice to the provided value

func (String) Shuffle added in v0.21.4

func (x String) Shuffle() String

Shuffle randomizes the order of the elements in the slice

Jump to

Keyboard shortcuts

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