add fx.Split

This commit is contained in:
kevin
2020-10-17 12:51:46 +08:00
parent 1d9c4a4c4b
commit d2ed14002c
3 changed files with 51 additions and 0 deletions

View File

@@ -1,11 +1,19 @@
package main
import (
"fmt"
"testing"
"github.com/tal-tech/go-zero/core/fx"
)
func TestFxSplit(t *testing.T) {
fx.Just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).Split(4).ForEach(func(item interface{}) {
vals := item.([]interface{})
fmt.Println(len(vals))
})
}
func BenchmarkFx(b *testing.B) {
type Mixed struct {
Name string