Categorygithub.com/digisan/go-generics
modulepackage
0.5.5
Repository: https://github.com/digisan/go-generics.git
Documentation: pkg.go.dev

# README

go-generics

golang generics for common other functions, Must be the lowest level

move all content from go-generics/v2 to go-generics/ go1.22.0 from here, version is v0.5.0

# Functions

No description provided by the author
No description provided by the author
s(any) must be []any.
No description provided by the author
T is return type.
No description provided by the author
T is return type.
if return type 'T' is []byte, then return value is v's printed string as []byte, NOT binary encoding optBase is 'parse (u)int base (2, 8, 10, 16)'.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
paths are like '1.2.3', '4.6.2'.
No description provided by the author
ConstBytesToStr converts byte slice to string without a memory allocation.
No description provided by the author
No description provided by the author
No description provided by the author
***.
***.
***.
***.
Equals.
get all fields.
get only exported field value.
*** input data keeps original, return filtered & ordered copy.
*** input data will be changed, filtered data keeps order, BUT return RE-ORDERED original set.
FilterMap : Filter A slice, return A=>B slice.
Filter A slice, return A=>B slice.
set simple primitive.
set map of primitive key & value.
set primitive array or slice.
set map of primitive key & slice of primitive value.
e.g.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
*** IdxOf : returns the index of the first instance of e in slice, or -1 if e is not present in slice.
IF : Ternary Operator LIKE < ? : >, BUT NO S/C src1 and src2 MUST all valid.
*** In : if arr has element e, return true.
No description provided by the author
init multiple dimension slice.
No description provided by the author
No description provided by the author
Intersect :.
No description provided by the author
IsContinuous : check numbers is continuous int slice.
No description provided by the author
No description provided by the author
No description provided by the author
check string format is email.
IsInt : Check v is valid int numeric style.
check string is valid IP.
nil-pointer could be non-nil any.
IsNumeric : Check v is valid numeric style.
IsSub :.
IsSuper :.
No description provided by the author
IsUint : Check v is valid uint numeric style.
No description provided by the author
Iter : for i := range Iter(end) / (start, end) / (start, step, end).
No description provided by the author
1,2,3,4 => (1,2), (2,3), (3,4), (4, junk).
IterToSlc : for i := range Iter(end) / (start, end) / (start, step, end).
1,2,3,4 => (1,2,3), (2,3,4), (3,4,junk), (4,junk,junk).
get all json tags.
No description provided by the author
last one @ idx=1; first one @ idx=len(arr).
*** LastIdxOf : returns the index of the last instance of e in slice, or -1 if e is not present in slice.
No description provided by the author
No description provided by the author
***.
e.g.
MapCopy:.
No description provided by the author
No description provided by the author
No description provided by the author
TK1: input map key type; TV1: input map value type; TK2: output map key type; TK2: output map value type;.
No description provided by the author
TK1: input map key type; TV1: input map value type; TK2: output map key type; TK2: output map value type;.
MapFilter:.
if fm return 'p' is "", then ignore this (path-value) to be into Nested.
if fm return 'p' is "", then ignore this (path-value) to be into Nested.
MapMerge:.
MapMergeOnValSlc :.
No description provided by the author
primitives keep together at leaves if string slice, use html escape symbols [&nbsp;] to replace space.
No description provided by the author
MapReplMerge.
MapSafeMerge:.
*** MapToKVs : map to key slice & value slice.
No description provided by the author
No description provided by the author
No description provided by the author
MATCH : NO ShortCut, MUST all valid, e.g.
***.
No description provided by the author
***.
***.
No description provided by the author
***.
No description provided by the author
No description provided by the author
No description provided by the author
*** NotIn : if arr does NOT have element e, return true.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
*** Reduce :.
*** Reorder : any index must less than len(arr); ([4,2,3,1],[2,1,3,0]) => [3,2,1,4].
*** Reverse : [1,2,3] => [3,2,1].
No description provided by the author
field must be exported, AND param value type can be converted to field value type.
m MUST have enough indexed space for elements in nested array.
No description provided by the author
slc must have enough dimension & capacity for all element, use 'InitSlice' to allocate multiple dimension slice before setting.
*** Settify : remove repeated elements in arr.
No description provided by the author
No description provided by the author
*** SmashArrays : [{2,2}, {3,3,4}, {6,6,8,8}] => {2,2,3,3,4,6,6,8,8}.
*** SmashSets : [{2,2}, {3,3,4}, {6,6,8,8}] => {2,3,4,6,8}.
No description provided by the author
No description provided by the author
No description provided by the author
StrToConstBytes converts string to byte slice without a memory allocation.
SubEq :.
No description provided by the author
SupEq :.
No description provided by the author
get all tags.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
fastest, but cannot cover all, e.g.
s(any) is any actual type of slice or array.
s(any) is any actual type of slice or array, T is return type.
No description provided by the author
Union :.
get all validator tags.
No description provided by the author
No description provided by the author
No description provided by the author
*** ZipSlice : [{1,2}, {3,4,5}, {6,7,8,9}] => [{1,3,6}, {2,4,7}].

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author