rock

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package rock As the cornerstone of implementing generic methods, implementing generic related operations with minimal dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractArrUnique added in v1.4.2

func ExtractArrUnique[T constraints.ValueIterable](count int, arr []T) []T

ExtractArrUnique extracting array elements with loss (non-repeatable) from an array

func ExtractParam

func ExtractParam[T any](defValue T, args ...T) T

ExtractParam Extract indefinite parameters from functions and default code values

func ExtractParamFunc added in v1.4.0

func ExtractParamFunc[T any](defFunc func() T, args ...T) T

ExtractParamFunc Implementing parameter extraction through custom callback functions

func ExtractParamIndex added in v1.4.1

func ExtractParamIndex[T any](defValue T, index int, args ...T) T

ExtractParamIndex Extract indefinite parameters from functions and default code values and point index

index => [1, ..]

func InList added in v1.5.0

func InList[T constraints.Equable](list []T, value T) bool

InList determines whether a key value exists in the list

func ListIndex added in v1.4.2

func ListIndex[T constraints.Equable](list []T, value T) (index int)

ListIndex get index by search value from list

func ListNoRepeat added in v1.4.2

func ListNoRepeat[T constraints.Equable](list []T) []T

ListNoRepeat filter duplicate elements in list

func MapAssign added in v1.4.2

func MapAssign[K constraints.KeyIterable, V constraints.ValueIterable](source map[K]V, more ...map[K]V) map[K]V

MapAssign Merge multiple map parameters, where the same key value is the forward overwrite value.

And never return nil.

func MapFilter added in v1.4.2

func MapFilter[K constraints.KeyIterable, V constraints.ValueIterable](kv map[K]V, filter []K) map[K]V

MapFilter use the keys of map to filter itself

func MapGenByKv added in v1.4.2

func MapGenByKv[K constraints.KeyIterable, V constraints.ValueIterable](keys []K, values []V) (kv map[K]V)

MapGenByKv Create dictionary by key value pair array combination

func MapKeys added in v1.4.2

func MapKeys[T constraints.KeyIterable, X constraints.ValueIterable](vMap map[T]X) (keys []T)

MapKeys Extract the key name array of the dictionary

func MapSlice added in v1.4.2

func MapSlice[K constraints.KeyIterable, V constraints.ValueIterable](kv map[K]V, filter []K) map[K]V

MapSlice use the keys of map to slice itself

func MapValues added in v1.4.2

func MapValues[T constraints.KeyIterable, X constraints.KeyIterable](vMap map[T]X) (values []X)

MapValues Extract the values name array of the dictionary

Types

This section is empty.

Jump to

Keyboard shortcuts

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