object

package
v0.0.0-...-9758427 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already exists")

ErrAlreadyExists - the object is already contained in the enumeration.

Functions

This section is empty.

Types

type Chunk

type Chunk[T any] []Slice[T]

Chunk - slice of elements split into groups the length of size.

func ChunkOf

func ChunkOf[T any](c [][]T) Chunk[T]

ChunkOf - method for converting a two-dimensional slice into a chunk.

func (Chunk[T]) Append

func (c Chunk[T]) Append(elems ...Slice[T]) Chunk[T]

func (Chunk[T]) Clone

func (c Chunk[T]) Clone() Chunk[T]

func (Chunk[T]) ForEach

func (c Chunk[T]) ForEach(fn func(index int, item *Slice[T])) Chunk[T]

func (Chunk[T]) Join

func (c Chunk[T]) Join() Slice[T]

func (Chunk[T]) Len

func (c Chunk[T]) Len() int

func (Chunk[T]) Redistribute

func (c Chunk[T]) Redistribute(size uint) Chunk[T]

func (Chunk[T]) Reverse

func (c Chunk[T]) Reverse() Chunk[T]

func (Chunk[T]) ReverseItems

func (c Chunk[T]) ReverseItems() Chunk[T]

func (Chunk[T]) Sort

func (c Chunk[T]) Sort(rule func(a, b Slice[T]) int) Chunk[T]

func (Chunk[T]) SortItems

func (c Chunk[T]) SortItems(rule func(a, b T) int) Chunk[T]

type Enum

type Enum[T comparable] []T

Enum - enumeration model for type E.

func (*Enum[T]) Add

func (e *Enum[T]) Add(value T) (result T, err error)

Add - add an object to the enumeration.

func (*Enum[T]) Contains

func (e *Enum[T]) Contains(value T) bool

Contains - enum contains element.

func (*Enum[T]) MustAdd

func (e *Enum[T]) MustAdd(value T) T

MustAdd - add an object to the enumeration. Panics if already exists.

type Map

type Map[K comparable, V any] map[K]V

func MapOf

func MapOf[K comparable, V any](m map[K]V) Map[K, V]

MapOf - method for converting a map into object.Map.

func (Map[K, V]) Action

func (m Map[K, V]) Action(actions ...MapAction[K, V]) Map[K, V]

func (Map[K, V]) Clone

func (m Map[K, V]) Clone() Map[K, V]

func (Map[K, V]) CopyFrom

func (m Map[K, V]) CopyFrom(src Map[K, V]) Map[K, V]

func (Map[K, V]) CopyTo

func (m Map[K, V]) CopyTo(dst Map[K, V]) Map[K, V]

func (Map[K, V]) Delete

func (m Map[K, V]) Delete(keys ...K) Map[K, V]

func (Map[K, V]) DeleteFunc

func (m Map[K, V]) DeleteFunc(del func(K, V) bool) Map[K, V]

func (Map[K, V]) ForEach

func (m Map[K, V]) ForEach(fn func(key K, item V)) Map[K, V]

func (Map[K, V]) Is

func (m Map[K, V]) Is(conditions ...MapCondition[K, V]) (ok bool)

func (Map[K, V]) Keys

func (m Map[K, V]) Keys() Slice[K]

func (Map[K, V]) Len

func (m Map[K, V]) Len() int

func (Map[K, V]) ScanKV

func (m Map[K, V]) ScanKV(keys Slice[K], values Slice[V]) Map[K, V]

func (Map[K, V]) ScanSlice

func (m Map[K, V]) ScanSlice(src Slice[V], fn func(item V) (key K)) Map[K, V]

func (Map[K, V]) Values

func (m Map[K, V]) Values() Slice[V]

type MapAction

type MapAction[K comparable, V any] func(Map[K, V]) Map[K, V]

type MapCondition

type MapCondition[K comparable, V any] func(K, V) bool

type Slice

type Slice[E any] []E

Slice - slice model of type E.

func SliceOf

func SliceOf[T any](s []T) Slice[T]

SliceOf - method for converting a model into a slice.

func (Slice[E]) Action

func (s Slice[E]) Action(actions ...SliceAction[E]) Slice[E]

func (Slice[E]) Append

func (s Slice[E]) Append(elems ...E) Slice[E]

func (Slice[E]) AppendSlice

func (s Slice[E]) AppendSlice(elems ...Slice[E]) Slice[E]

func (Slice[E]) Cap

func (s Slice[E]) Cap() int

func (Slice[E]) Chunk

func (s Slice[E]) Chunk(size uint) Chunk[E]

func (Slice[E]) Clip

func (s Slice[E]) Clip() Slice[E]

func (Slice[E]) Clone

func (s Slice[E]) Clone() Slice[E]

func (Slice[E]) CopyFrom

func (s Slice[E]) CopyFrom(src Slice[E]) Slice[E]

func (Slice[E]) CopyTo

func (s Slice[E]) CopyTo(dst Slice[E]) Slice[E]

func (Slice[E]) Delete

func (s Slice[E]) Delete(i, j int) Slice[E]

func (Slice[E]) DeleteFunc

func (s Slice[E]) DeleteFunc(del func(E) bool) Slice[E]

func (Slice[E]) ForEach

func (s Slice[E]) ForEach(fn func(index int, item *E)) Slice[E]

func (Slice[E]) Is

func (s Slice[E]) Is(conditions ...SliceCondition[E]) (ok bool)

func (Slice[E]) Len

func (s Slice[E]) Len() int

func (Slice[E]) Reverse

func (s Slice[E]) Reverse() Slice[E]

func (Slice[E]) Sort

func (s Slice[E]) Sort(rule order.Sort[E]) Slice[E]

type SliceAction

type SliceAction[I any] func(slice Slice[I]) Slice[I]

Slice - slice model of type E.

type SliceCondition

type SliceCondition[I any] func(index int, item I) bool

Slice - slice model of type E.

Jump to

Keyboard shortcuts

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