Releases: logic-building/functional-go
go mod issue
fix issues with higher versioning number
go mod issue
add go mod file with new version series ver1.0.0 to fix go mod issue with some internal file use with higher version.
Method chain functionality
Method chain functionality for Basic type as well as struct -
Map, Filter, Sort, Distinct, Reverse, DropWhile, TakeWhile, Remove
Example:
// Use MakeIntSlicePtr for pointer version
r := fp.MakeIntSlice([]int{3, 2, 1}...).
Filter(odd).
Map(square).
Sort()
fmt.Println(r) // [1 9]
func odd (num int) bool {
return num % 2 != 0
}
func square(num int) int {
return num * num
}
Optional Parameter for PMap to set number of Goroutines(worker)
Eg:
PMapInt(squareInt, []int{v1, v2, v3}, Optional{FixedPool: 2, RandomOrder: true})
The default behavior of PMap:
a. number of Goroutines == length of the list.
b. Order is guaranteed
Generated Code for Struct has new functions - Distinct, Intersection, Set, Union, Difference, Superset, Subset
New functions for struct - (Distinct, Intersection, Union, Difference, Superset, Subset, Set) compares each member of a struct with another struct in the list.
Disabled Distinct for user defined type, it will be enabled in future
Merge pull request #128 from logic-building/fix-distinct-auto-generate Disabled distinct for user defined typefor some issue, it will be ena…
New Function - Equal<Type>sP, EqualMap<Type>, Distinct<Type>P
New functions to compare slice and map.
EqualsP : eg EqualIntsP, EqualFloats64P
EqualMap: eg. EqualMapIntP , EqualMapInt64Float64P
New function to check if the slice is distinct
DistinctP: eg. DistinctIntP
Auto-generate code for struct has options to include the only list -
//go:generate gofp -destination fp.go -pkg employee -type "Employee" -only "Distinct, DistinctPtr, DistinctP"
A full list of value for option only
is provided in README
New Function - Dedupe<Type>
Added function - Dedupe
Auto-generated code for sorting for struct takes pointer types.
Auto-generated code for struct has set and sort related functions as default.
Auto-generated code for struct has set and sort related functions as default.
Options -set or -sort will override the default behavior of auto-generation of functions related to set & sort.
Added new predicate functions:
a. ZeroP
b. NegP
c. PosP
d. EvenP
e. OddP
Auto-generated code for struct has set and sort related functions as default.
Auto-generated code for struct has set and sort related functions as default.
Options -set or -sort will override the default behavior of auto-generation of functions related to set & sort.
Added new predicate functions:
a. ZeroP
b. NegP
c. PosP
d. EvenP
e. OddP