Documentation
¶
Index ¶
- Variables
- func Contain(slice interface{}, fn CondFunc) bool
- func Containable[T comparable](fn CondFunc2[T]) func([]T) bool
- func Conv[S, D any](srcs []S, convfn ConvFunc[S, D]) (dsts []D)
- func Convertable[S, D any](fn ConvFunc[S, D]) func([]S) []D
- func DefauiltOpt[T any]() *opParam[T]
- func Delete(slice interface{}, funcs ...CondFunc) error
- func Every[T any](fn CondFunc2[T]) func(...T) bool
- func EveryWithIndex[T comparable](fn CondFuncWithIndex[T]) func(...T) bool
- func Filter[T comparable](slice []T, condFn CondFunc2[T], opts ...Opt[FilterOpt[T]]) ([]T, error)
- func Find(slice interface{}, fn CondFunc) (interface{}, error)
- func IndexOf(slice interface{}, fn CondFunc) (int, error)
- func Inject[T any, V any](s []T, injectFn InjectFn[T, V], opts ...OptCurry[V]) (v V)
- func Intersect[T comparable](slice1, slice2 []T, opts ...Opt[IntersectOpt]) (result []T)
- func IntersectSorted[T any, V Ordered](slice1, slice2 []T, IdentFn IdentFunc[T, V]) (result []T)
- func Keys[K comparable, V any](m map[K]V) (keys []K)
- func LastIndexOf(slice interface{}, fn CondFunc) (int, error)
- func MergeOpts[T any](opts ...Opt[T]) (*opParam[T], func(p *opParam[T]))
- func NewOpt[T any](opts ...OptCurry[T]) *curryParam[T]
- func OldFilter(slice interface{}, funcs ...CondFunc) error
- func Reduce[T any, V any](s []T, injectFn InjectFn[T, V]) (v V)
- func Reverse(slice interface{})
- func Select(slice interface{}, fn CondFunc) (interface{}, error)
- func SelectMap[K comparable, V any](m map[K]V, fn func(k K, v V) (K, V, bool)) (result map[K]V)
- func Shuffle(slice interface{}, seeds ...int64) (e error)
- func Sub[T comparable](slice1, slice2 []T, opts ...Opt[subOpt]) (result []T)
- func SubSorted[T any, V Ordered](slice1, slice2 []T, IdentFn IdentFunc[T, V]) (result []T)
- func Sum[T Ordered](s []T) (v T)
- func SumWithFn[T any, V Ordered](s []T, fn SumIdent[T, V]) (v V)
- func ToMap[K, V constraints.Ordered](r map[K]V, k K, v V) map[K]V
- func Uniq(slice interface{}, fn IdentFn) error
- func Uniq2(slice interface{}, fn CompareFunc) error
- func UniqWithSort(slice interface{}, fn CompareFunc) (int, error)
- func Values[K comparable, V any](m map[K]V) (values []V)
- func Zipper[T, S, R any](fn func(R, T, S) R, start R) func([]T, []S) R
- type CompareFunc
- type CondFunc
- type CondFunc2
- type CondFunc3
- type CondFuncWithIndex
- type CondFuncWithPtr
- type ConvFunc
- type FilterFunc
- type FilterOpt
- type GetFunc
- type IdentFn
- type IdentFunc
- type InjectFn
- type InjecterFunc
- type IntersectOpt
- type Number
- type Opt
- type OptCurry
- type Ordered
- type SumIdent
Constants ¶
This section is empty.
Variables ¶
var ( ERR_SLICE_TYPE error = errors.New("parameter must be slice or pointer of slice") ERR_POINTER_SLICE_TYPE error = errors.New("parameter must be pointer of slice") ERR_NOT_FOUND error = errors.New("data is not found") ERR_ELEMENT_INVALID_TYPE error = errors.New("slice element is invalid type") ERR_INVALID_INDEX error = errors.New("invalid index") )
Functions ¶
func Containable ¶ added in v0.6.2
func Containable[T comparable](fn CondFunc2[T]) func([]T) bool
Containable ... generate function of slice contain.
func Convertable ¶ added in v0.6.2
Convertable ... generate function of slice conversion.
func DefauiltOpt ¶ added in v0.5.1
func DefauiltOpt[T any]() *opParam[T]
DefauiltOpt ... default function option
func Every ¶ added in v0.6.3
Every ... Determines whether all the members of an array satisfy the specified test.
func EveryWithIndex ¶ added in v0.6.3
func EveryWithIndex[T comparable](fn CondFuncWithIndex[T]) func(...T) bool
EveryWithIndex ... Determines whether all the members of an array satisfy the specified test.
func Filter ¶
func Filter[T comparable](slice []T, condFn CondFunc2[T], opts ...Opt[FilterOpt[T]]) ([]T, error)
Filter ... FIlter implementation with type parameters
func Find ¶
Find is value of slice if fn is true. if slice is not pointer of slice or empty, return error
func IndexOf ¶
IndexOf gets the index at which the first match fn is true. if not found. return -1. return error if slice is not pointer of the slice.
func Intersect ¶ added in v0.5.1
func Intersect[T comparable](slice1, slice2 []T, opts ...Opt[IntersectOpt]) (result []T)
Intersect ... intersection between 2 slice.
func IntersectSorted ¶ added in v0.5.1
IntersectSorted ... intersection between 2 sorted slice
func Keys ¶ added in v0.5.6
func Keys[K comparable, V any](m map[K]V) (keys []K)
func LastIndexOf ¶ added in v0.1.1
LastIndexOf gets the last index at which the last match fn is true. if not found. return -1. return error if slice is not pointer of the slice.
func MergeOpts ¶ added in v0.5.1
MergeOpts ... using innner in function with Opt[T]
this run DefaultOpt() and Options() .
func OldFilter ¶ added in v0.5.6
OldFilter ... OldFilter element with mached funcs Deprecated: should use FIlter
func Reverse ¶ added in v0.1.2
func Reverse(slice interface{})
Reverse ... Transforms an array such that the first element will become the last, the second element will become the second to last, etc.
func SelectMap ¶ added in v0.5.6
func SelectMap[K comparable, V any](m map[K]V, fn func(k K, v V) (K, V, bool)) (result map[K]V)
SelectMap ... rewrite map each key, value pair.
func Shuffle ¶
Shuffle is shuffing slice order. if slice is not pointer of slice or not slice, return error
func Sub ¶ added in v0.5.4
func Sub[T comparable](slice1, slice2 []T, opts ...Opt[subOpt]) (result []T)
Sub .. subtraction between two slices.
func Sum ¶ added in v0.5.6
func Sum[T Ordered](s []T) (v T)
Sum ... sum of slice values in Ordered type
func SumWithFn ¶ added in v0.5.6
SumWithFn ... sum of slice values in non-Ordered type with SumIdent()
func ToMap ¶ added in v0.6.2
func ToMap[K, V constraints.Ordered](r map[K]V, k K, v V) map[K]V
ToMap ... function for Zipper . return map from double array.
func Uniq2 ¶
func Uniq2(slice interface{}, fn CompareFunc) error
Uniq2 is deduplicate using fn . if slice is not pointer of slice or empty, return error
func UniqWithSort ¶
func UniqWithSort(slice interface{}, fn CompareFunc) (int, error)
UniqWithSort is deduplicating using fn, sorting before dedup. if slice is not pointer of slice or empty, return error
func Values ¶ added in v0.5.6
func Values[K comparable, V any](m map[K]V) (values []V)
Types ¶
type CompareFunc ¶
type CondFuncWithIndex ¶ added in v0.6.3
type CondFuncWithPtr ¶ added in v0.6.3
type FilterFunc ¶ added in v0.6.1
type FilterFunc[T any] func([]T) []T
FilterFunc ... function generated by Filterlize()
func Deletable ¶ added in v0.6.1
func Deletable[T comparable](fns ...CondFunc2[T]) FilterFunc[T]
Deletable ... generate deleting function by fns Condition for slice
func Filterable ¶ added in v0.6.1
func Filterable[T any](fns ...CondFunc2[T]) FilterFunc[T]
Filterable ... generate filter function for slice
func Selectable ¶ added in v0.6.1
func Selectable[T any](fns ...CondFunc2[T]) FilterFunc[T]
Selectable ... generate deleting function by fns Condition for slice
type FilterOpt ¶ added in v0.5.6
type FilterOpt[T any] struct { // contains filtered or unexported fields }
FilterOpt ... functional option for FIlter2()
type InjecterFunc ¶ added in v0.6.1
InjecterFunc ... condition function for Injectable
func Injectable ¶ added in v0.6.1
func Injectable[T any, V any](injectFn InjectFn[T, V], opts ...OptCurry[V]) InjecterFunc[T, V]
Injectable ... generate Inject functions
type IntersectOpt ¶ added in v0.5.6
type IntersectOpt struct {
Uniq bool
}
type Number ¶ added in v0.6.2
type Number interface { constraints.Integer | constraints.Float }
Number ... Number constraints
type Opt ¶ added in v0.5.1
Opt ... functional options of lonch operator
func Cond2 ¶ added in v0.5.6
func Cond2[OptT any, S comparable, OptPT condFuncSetter2[OptT, S]](fns ...CondFunc2[S]) Opt[OptT]
Cond2 ... no index variant of Cond
func FilterVersion ¶ added in v0.5.6
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
ContainerListWriter is a base of http://golang.org/pkg/container/list/ this is tuning performancem, reduce heap usage.
|
ContainerListWriter is a base of http://golang.org/pkg/container/list/ this is tuning performancem, reduce heap usage. |
Package loncha/list_head is like a kernel's LIST_HEAD list_head is used by loncha/gen/containers_list
|
Package loncha/list_head is like a kernel's LIST_HEAD list_head is used by loncha/gen/containers_list |