flow

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 4 Imported by: 0

README ΒΆ

flow

Action Report Card Lines of code godoc License

✨ xuender/flow is a ...

πŸš€ Install

go install gitee.com/xuender/flow@latest

πŸ’‘ Usage

TODO

Flow Operation
  • Chain
  • Parallel
Intermediate Operations
  • Filter
  • FlatMap
  • Limit
  • Map
  • Peek
  • Reverse
  • Skip
  • Sort
  • Unique
Terminal Operations
  • seq.Count
  • seq.Each
  • seq.First
  • seq.Max
  • seq.Min
  • seq.Sum
  • seq.Join
Seq Operations
  • seq.Chan
  • seq.Emit
  • seq.Range
  • seq.Filter
  • seq.FlatMap
  • seq.Limit
  • seq.Map
  • seq.Peek
  • seq.Reverse
  • seq.Skip
  • seq.Sort
  • seq.Unique

πŸ‘€ Contributors

Contributors

πŸ“ License

Β© ender, 2024~time.Now

MIT LICENSE

Documentation ΒΆ

Index ΒΆ

Examples ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func Chain ΒΆ

func Chain[E any](seq iter.Seq[E], steps ...Step[E, E]) iter.Seq[E]
Example ΒΆ
package main

import (
	"fmt"

	"gitee.com/xuender/flow"
	"gitee.com/xuender/flow/seq"
)

func main() {
	fmt.Println(seq.Max(flow.Chain(
		seq.Range(100),
		flow.Limit[int](3),
		flow.Filter(func(num int) bool { return num%2 == 0 }),
	)))

}
Output:

2 true

func Parallel ΒΆ

func Parallel[E any](size int, items iter.Seq[E], steps ...Step[E, E]) iter.Seq[E]
Example ΒΆ
package main

import (
	"fmt"

	"gitee.com/xuender/flow"
	"gitee.com/xuender/flow/seq"
)

func main() {
	for num := range flow.Parallel(
		2,
		seq.Range(100),
		flow.Limit[int](3),
		flow.Filter(func(num int) bool { return num%3 == 0 }),
	) {
		fmt.Println(num)
	}

}
Output:

0
3

Types ΒΆ

type Step ΒΆ

type Step[I, O any] func(iter.Seq[I]) iter.Seq[O]

func Filter ΒΆ

func Filter[E any](predicate func(E) bool) Step[E, E]

func FlatMap ΒΆ

func FlatMap[S ~[]E, E any]() Step[S, E]

func Limit ΒΆ

func Limit[E any](limit int) Step[E, E]

func Map ΒΆ

func Map[I, O any](mappger func(I) O) Step[I, O]

func Peek ΒΆ

func Peek[E any](action func(E)) Step[E, E]

func Reverse ΒΆ

func Reverse[E any]() Step[E, E]

func Skip ΒΆ

func Skip[E any](num int) Step[E, E]

func Sort ΒΆ

func Sort[E cmp.Ordered]() Step[E, E]

func Unique ΒΆ

func Unique[E comparable]() Step[E, E]

Directories ΒΆ

Path Synopsis
_examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL