iterator

package
v2.42.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator[Req PageRequest, T any] struct {
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator[Req PageRequest, T any](
	ctx context.Context,
	req Req,
	fetch PageFetcher[Req, T],
	opts ...grpc.CallOption,
) *Iterator[Req, T]

func (*Iterator[Req, T]) Error

func (it *Iterator[Req, T]) Error() error

func (*Iterator[Req, T]) Next

func (it *Iterator[Req, T]) Next() bool

func (*Iterator[Req, T]) NextPageToken

func (it *Iterator[Req, T]) NextPageToken() string

func (*Iterator[Req, T]) Take

func (it *Iterator[Req, T]) Take(size int64) ([]T, error)

func (*Iterator[Req, T]) TakeAll

func (it *Iterator[Req, T]) TakeAll() ([]T, error)

func (*Iterator[Req, T]) Value

func (it *Iterator[Req, T]) Value() T

type PageFetcher

type PageFetcher[Req PageRequest, T any] func(
	ctx context.Context,
	req Req,
	opts ...grpc.CallOption,
) (PageResponse[T], error)

type PageRequest

type PageRequest interface {
	GetPageSize() int64
	SetPageSize(int64)
	GetPageToken() string
	SetPageToken(string)
}

type PageResponse

type PageResponse[T any] interface {
	Items() []T
	GetNextPageToken() string
}

Jump to

Keyboard shortcuts

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