Documentation ¶
Index ¶
- Constants
- func Parse(v string) (int32, error)
- func Ptr(v int32) *int32
- func PtrDefToNil(v int32, def int32) *int32
- func PtrZeroToNil(v int32) *int32
- func Val(v *int32) int32
- func ValDef(v *int32, def int32) int32
- type Map
- type PredicateFunc
- type ReceiveFunc
- type Slice
- func (s Slice) Apply(t TransformFunc)
- func (s Slice) Clone() Slice
- func (s Slice) Filter(p PredicateFunc) Slice
- func (s Slice) ForEach(r ReceiveFunc)
- func (s Slice) IsSorted() bool
- func (s Slice) Len() int
- func (s Slice) Less(i, j int) bool
- func (s Slice) Map(t TransformFunc) Slice
- func (s Slice) SafeGet(i int) int32
- func (s Slice) SafeGetDef(i int, def int32) int32
- func (s Slice) SafeGetPtr(i int) *int32
- func (s Slice) Sort()
- func (s Slice) Swap(i, j int)
- func (s Slice) ToInterfaces() []interface{}
- func (s Slice) ToMap() Map
- type TransformFunc
Constants ¶
const (
// BitSize is the size in bits of this type.
BitSize = 32
)
Variables ¶
This section is empty.
Functions ¶
func PtrDefToNil ¶
PtrDefToNil returns a pointer to the value, or nil if "def".
func PtrZeroToNil ¶
PtrZeroToNil returns a pointer to the value, or nil if 0.
Types ¶
type Map ¶
type Map map[int32]struct{}
Map is a map of values.
func (Map) Filter ¶
func (m Map) Filter(p PredicateFunc) Map
Filter the Map to a copy using the given PredicateFunc (if p(v) = true, the value is copied, otherwise skipped).
func (Map) ForEach ¶
func (m Map) ForEach(r ReceiveFunc)
ForEach invokes ReceiveFunc for each key in the Map.
func (Map) Map ¶
func (m Map) Map(t TransformFunc) Map
Map the Map to a copy using the given TransformFunc.
type PredicateFunc ¶
PredicateFunc describes a function that evaluates values of type int32.
func And ¶
func And(ps ...PredicateFunc) PredicateFunc
And performs a lazy logical AND using the given PredicateFunc(s). Always returns true if len(ps) = 0.
func Or ¶
func Or(ps ...PredicateFunc) PredicateFunc
Or performs a lazy logical OR using the given PredicateFunc(s). Always returns false if len(ps) = 0.
type ReceiveFunc ¶
type ReceiveFunc func(int32)
ReceiveFunc describes a function that receives values of type int32.
type Slice ¶
type Slice []int32
Slice is a slice of values.
func (Slice) Filter ¶
func (s Slice) Filter(p PredicateFunc) Slice
Filter the Slice to a copy using the given PredicateFunc (if p(v) = true, the value is copied, otherwise skipped).
func (Slice) ForEach ¶
func (s Slice) ForEach(r ReceiveFunc)
ForEach invokes ReceiveFunc for each value in the Slice.
func (Slice) Map ¶
func (s Slice) Map(t TransformFunc) Slice
Map the Slice to a copy using the given TransformFunc.
func (Slice) SafeGetDef ¶
SafeGetDef returns "s[i]" if possible, "def" otherwise.
func (Slice) SafeGetPtr ¶
SafeGetPtr returns a pointer to the value of "s[i]" if possible, an nil otherwise.
func (Slice) ToInterfaces ¶
func (s Slice) ToInterfaces() []interface{}
ToInterfaces copies all elements of the Slice to a []interface{}.
type TransformFunc ¶
TransformFunc describes a function that transforms values of type int32.