Skip to main content Link Search Menu Expand Document (external link)

FromGenerator

func FromGenerator[T any](pipeline *Pipeline, generator func(i uint64) T) *Channel[T]

FromGenerator creates a Channel from a stateless generator function. Values returned by the function are sent to the channel in order.

Example

channel := FromGenerator(pipeline, func(i int64) int64 { return i * 10 })