2
0

reader.go 457 B

123456789101112131415
  1. package reader
  2. import (
  3. "context"
  4. )
  5. // Reader is a generic, io.Reader-style streaming interface. Read fills dst with
  6. // up to len(dst) items and returns the number read. When the stream is
  7. // exhausted it returns io.EOF, which may accompany a non-zero count on the
  8. // final read; callers must always process the returned items before honoring
  9. // the error.
  10. type Reader[T any] interface {
  11. Read(ctx context.Context, dst []T) (int, error)
  12. Close() error
  13. }