Documentation
¶
Index ¶
- func NewContReader(args NewContReaderArgs) core.Reader[Page]
- func NewContWriter[T any](args NewContWriterArgs[T]) core.Writer[T]
- func NewOnceReader(args NewOnceReaderArgs) core.Reader[Page]
- func NewOnceWriter[T any](args NewOnceWriterArgs[T]) core.Writer[T]
- type NewContReaderArgs
- type NewContWriterArgs
- type NewOnceReaderArgs
- type NewOnceWriterArgs
- type Page
- type Paged
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContReader ¶
func NewContReader(args NewContReaderArgs) core.Reader[Page]
NewContReader passes ints from args.Reader to NewOnceReader, from which pages are returned here. When all pages are read, a new int from args.Reader is passed to a new NewOnceReader, and so on.
Examples (interactive):
func NewContWriter ¶
func NewContWriter[T any](args NewContWriterArgs[T]) core.Writer[T]
NewContWriter returns a writer which writes values to args.Writer along with pagination directives coming from an internal NewContReader made with args.Reader and args.Limit.
Examples (interactive):
func NewOnceReader ¶
func NewOnceReader(args NewOnceReaderArgs) core.Reader[Page]
NewOnceReader returns a Reader of pagination directives which supports paging from 0 to 'total' with the given 'limit', then returns an io.EOF. It is useful for e.g paging through a database if you know the total size.
Examples (interactive):
func NewOnceWriter ¶
func NewOnceWriter[T any](args NewOnceWriterArgs[T]) core.Writer[T]
NewOnceWriter returns a writer which writes values to args.Writer along with pagination directives, based on args.Total and args.Limit, which are passed to NewOnceReader under the hood. When all pages are written, the writer returned here will give an io.ErrClosedPipe.
Examples (interactive):