fx
所属分类:开发工具
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2022-01-09 15:18:11
上 传 者:
sh-1993
说明: Fx是一个有用的函数编程助手。,
(Fx is a useful functional programming helpers.,)
文件列表:
LICENSE (1072, 2022-01-09)
ch/ (0, 2022-01-09)
ch/ch.go (771, 2022-01-09)
ch/ch_test.go (1145, 2022-01-09)
docs/ (0, 2022-01-09)
docs/.nojekyll (0, 2022-01-09)
docs/_sidebar.md (107, 2022-01-09)
docs/channel.md (144, 2022-01-09)
docs/index.html (925, 2022-01-09)
docs/map.md (1237, 2022-01-09)
docs/slice.md (3622, 2022-01-09)
go.mod (265, 2022-01-09)
go.sum (923, 2022-01-09)
kv/ (0, 2022-01-09)
kv/kv.go (813, 2022-01-09)
kv/kv_test.go (1150, 2022-01-09)
slice/ (0, 2022-01-09)
slice/slice.go (5190, 2022-01-09)
slice/slice_test.go (5960, 2022-01-09)
# fx
[![Status](https://github.com/nikgalushko/fx/actions/workflows/go.yaml/badge.svg)](https://github.com/nikgalushko/fx/actions/workflows/go.yaml) [![Coverage Status](https://coveralls.io/repos/github/nikgalushko/fx/badge.svg?branch=main)](https://coveralls.io/github/nikgalushko/fx?branch=main)
Fx is a useful functional programming helpers without using `interface{}` or reflect.
Support **only** Go 1.18+.
## Features
- Slice
- Each
- Collect
- Reduce
- Find
- Filter
- Every
- Some
- Contains
- Max
- Min
- GroupBy
- Sample
- SampleN
- Union
- Intersection
- Uniq
- IndexOf
- LastIndexOf
- Reverse
- Map
- Keys
- Values
- Each
- Filter
- Channel
- Merge
## Documentation
Documentation with examples can be found here: https://nikgalushko.github.io/fx/
## Installation
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`
## Usage
```go
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: "!"}))
}
```
近期下载者:
相关文件:
收藏者: