Skip to content

Releases: logic-building/functional-go

New option -set to generate set functions for struct

22 Jun 22:54
712be0a
Compare
Choose a tag to compare
  1. Added standard set functions: Union, Intersection, Difference, Set, Superset, Subset.

  2. 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

  1. SetEmployeeByName
  2. UnionEmployeeBytName
  3. IntersectionEmployeeByName
  4. DifferenceEmployeeByName
  5. SupersetEmployeeByName
  6. SubsetEmployeeByName

New option `-sort` to auto generate sorting methods for struct

02 Jun 14:26
1c3c8f2
Compare
Choose a tag to compare

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:

  1. SortEmployeeByName
  2. SortEmployeeByNameDesc
  3. SortEmployeeByNamePtr
  4. 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

22 May 16:30
Compare
Choose a tag to compare
v8.7.2

deleted file go.mod and go.sum

Minor update in readme

22 May 01:56
e9dcc46
Compare
Choose a tag to compare
v8.7.1

Update README.md

New function - PMap<INPUT_TYPE><OUTPUT_TYPE>PtrErr

22 May 00:03
cd3796e
Compare
Choose a tag to compare

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

19 May 21:19
5cf135d
Compare
Choose a tag to compare

Added new functionality for PMap to support error handling.

New functionality supports error handling

02 May 21:07
8130ca0
Compare
Choose a tag to compare

Now there are four variants of functions:

  1. MapInt: Returns new List (Old)
  2. MapIntPtr: Returns new list with a pointer type (Old)
  3. MapIntErr : Returns new list and error (New)
  4. 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

01 Apr 18:45
e0118c6
Compare
Choose a tag to compare

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

30 Mar 22:27
7573265
Compare
Choose a tag to compare

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

28 Feb 23:58
4397b27
Compare
Choose a tag to compare

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