Fx is a useful functional programming helpers.
See the codeFx is a useful functional programming helpers without using interface{} or reflect.
Support only Go 1.18+.
Documentation with examples can be found here: https://nikgalushko.github.io/fx/
slice helpers go get github.com/nikgalushko/fx/slice
map helpers go get github.com/nikgalushko/fx/kv
channel helpers go get github.com/nikgalushko/fx/ch
import (
"fmt"
"github.com/nikgalushko/fx/kv"
"github.com/nikgalushko/fx/slice"
)
type (
ID string
Attribute struct {
Value string
}
)
func main() {
m := map[ID]Attribute{
ID("1"): {Value: "blah"},
ID("1861"): {Value: "!"},
ID("1234"): {Value: "yeah"},
}
fmt.Println("ids", kv.Keys(m), "contains special", slice.Contains(kv.Values(m), Attribute{Value: "!"}))
}
42 commits
Go
100.0%
Fx is a useful functional programming helpers.
See the codeFx is a useful functional programming helpers without using interface{} or reflect.
Support only Go 1.18+.
Documentation with examples can be found here: https://nikgalushko.github.io/fx/
slice helpers go get github.com/nikgalushko/fx/slice
map helpers go get github.com/nikgalushko/fx/kv
channel helpers go get github.com/nikgalushko/fx/ch
import (
"fmt"
"github.com/nikgalushko/fx/kv"
"github.com/nikgalushko/fx/slice"
)
type (
ID string
Attribute struct {
Value string
}
)
func main() {
m := map[ID]Attribute{
ID("1"): {Value: "blah"},
ID("1861"): {Value: "!"},
ID("1234"): {Value: "yeah"},
}
fmt.Println("ids", kv.Keys(m), "contains special", slice.Contains(kv.Values(m), Attribute{Value: "!"}))
}
42 commits
Go
100.0%