Releases: logic-building/functional-go
New option -set to generate set functions for struct
-
Added standard set functions: Union, Intersection, Difference, Set, Superset, Subset.
-
Added option -set to generate set functions- Union, Intersection, Difference, Set, Superset, Subset for struct.
eg.
//go:generate gofp -destination fp.go -pkg employee -type "Employee" -set "Employee:Name:string"
New Generated Functions will be
- SetEmployeeByName
- UnionEmployeeBytName
- IntersectionEmployeeByName
- DifferenceEmployeeByName
- SupersetEmployeeByName
- SubsetEmployeeByName
New option `-sort` to auto generate sorting methods for struct
Auto-generated code has a new option to generate sorting methods for struct:
-sort "Employee:Name, Employee:Salary"
eg:
//go:generate gofp -destination fp.go -pkg employee -type "Employee" -sort "Employee:Name"
type Employee struct {
Id int
Name string
Salary float64
}
Generated sorting functions:
- SortEmployeeByName
- SortEmployeeByNameDesc
- SortEmployeeByNamePtr
- SortEmployeeByNameDescPtr
New Standard functions:
Reverse: To reverse list
Ex. ReverseInt
Keys: return keys of the map
Take: return n items from the list
Minor change - removed go.mod file
v8.7.2 deleted file go.mod and go.sum
Minor update in readme
v8.7.1 Update README.md
New function - PMap<INPUT_TYPE><OUTPUT_TYPE>PtrErr
This new function takes a different type of input and returns a different type of output.
Eg.
r, err := PMapStrIntErr(fun1, []string{"ram", "jesus"})
func fun1(v string) (int, error) {
// some logic
return 0, nil
}
Auto-generated code for user-defined type has this functionality too.
Eg.
r, err := PMapStrEmployeeErr(fun1, []string{"ram", "jesus"})
PMap supports error handling
Added new functionality for PMap to support error handling.
New functionality supports error handling
Now there are four variants of functions:
- MapInt: Returns new List (Old)
- MapIntPtr: Returns new list with a pointer type (Old)
- MapIntErr : Returns new list and error (New)
- MapIntPtrErr: Returns new list with pointer type and error(New)
All four variants are supported in the following functions:
Map
Filter
FilterMap
DropWhile
Every
Remove
Reduce
Some
TakeWhile
Pointer function for user defined data type in auto-generate code
Added function to support pointer for the user-defined data type in auto-generate code. "Ptr" is appended in each new function.
Available functions:
Map -> MapInt, MapStrInt, MapIntPtr ...
Filter -> FilterInt, FilterStrInt, FilterIntPtr ...
FilterMap -> FilterMapInt, FilterMapIntStr, FilterMapIntPtr ...
PMap -> PMapInt, PMapIntStr, PMapInt, PMapIntPtr ...
Distinct
Drop
DropWhile
Every
Max
Min
MinMax
Range
Remove
Reduce
Rest
Some
TakeWhile
Merge
Zip
Auto-generated functions for the user-defined data type for a different combination of input and output
Map, MapPtr
Filter, FilterPtr
FilterMap, FilterMapPtr
PMap, PMapPtr
Reduce, ReducePtr
Remove, RemovePtr
Some, SomePtr
TakeWhile, TakeWhilePtr
DropWhile, DropWhilePtr
Every, EveryPtr
Rest, RestPtr
Merge, MergePtr
Zip, ZipPtr
pointer function
Added function to support pointer data type. Added Ptr at end of each function to call pointer data type.
MapIntPtr...
FilterMapPtr...
.
.
.
Available functions:
Map -> MapInt, MapStrInt, MapIntPtr ...
Filter -> FilterInt, FilterStrInt, FilterIntPtr ...
FilterMap -> FilterMapInt, FilterMapIntStr, FilterMapIntPtr ...
PMap -> PMapInt, PMapIntStr, PMapInt, PMapIntPtr ...
Distinct
Drop
DropWhile
Every
Max
Min
MinMax
Range
Remove
Reduce
Rest
Some
TakeWhile
Merge
Zip
Auto-generated functions for the user-defined data type for a different combination of input and output
Map
Filter, FilterPtr
FilterMap
Pmap
Reduce
Remove
Some
TakeWhile
DropWhile
Every
Rest
Merge
Zip
Added function - Merge and Zip
Merge - Merges 2 maps and returns a new map
Zip - Zip two lists and return a new map
Available functions:
Map -> MapInt, MapStrInt ...
Filter -> FilterInt, FilterStrInt ...
FilterMap -> FilterMapInt, FilterMapIntStr ...
PMap -> PMapInt, PMapIntStr ...
Distinct
Drop
DropWhile
Every
Max
Min
MinMax
Range
Remove
Reduce
Rest
Some
TakeWhile
Merge
Zip
Auto generated functions for user defined data type for different combination of input and output
Map
Filter
FilterMap
Pmap
Reduce
Remove
Some
TakeWhile
DropWhile
Every
Rest
Merge
Zip