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]) NextPageToken ¶
type PageFetcher ¶
type PageFetcher[Req PageRequest, T any] func( ctx context.Context, req Req, opts ...grpc.CallOption, ) (PageResponse[T], error)
type PageRequest ¶
type PageResponse ¶
type SimpleFetcher ¶ added in v2.45.0
type SimpleFetcher[Req any, T any] func( ctx context.Context, req Req, opts ...grpc.CallOption, ) (SimpleResponse[T], error)
SimpleFetcher is the function type that fetches all items in a single request.
type SimpleIterator ¶ added in v2.45.0
SimpleIterator iterates over items from a non-paginated List method. Unlike Iterator, it fetches all items in a single request.
func NewSimpleIterator ¶ added in v2.45.0
func NewSimpleIterator[Req any, T any]( ctx context.Context, req Req, fetch SimpleFetcher[Req, T], opts ...grpc.CallOption, ) *SimpleIterator[Req, T]
NewSimpleIterator creates a new iterator for non-paginated responses.
func (*SimpleIterator[Req, T]) Error ¶ added in v2.45.0
func (it *SimpleIterator[Req, T]) Error() error
Error returns the error that occurred during iteration, if any.
func (*SimpleIterator[Req, T]) Next ¶ added in v2.45.0
func (it *SimpleIterator[Req, T]) Next() bool
Next advances the iterator to the next item. Returns true if there is an item available, false otherwise.
func (*SimpleIterator[Req, T]) Take ¶ added in v2.45.0
func (it *SimpleIterator[Req, T]) Take(size int64) ([]T, error)
Take returns up to size items from the iterator. If size is 0, returns all items.
func (*SimpleIterator[Req, T]) TakeAll ¶ added in v2.45.0
func (it *SimpleIterator[Req, T]) TakeAll() ([]T, error)
TakeAll returns all items from the iterator.
func (*SimpleIterator[Req, T]) Value ¶ added in v2.45.0
func (it *SimpleIterator[Req, T]) Value() T
Value returns the current item. Panics if called on an empty iterator.
type SimpleResponse ¶ added in v2.45.0
type SimpleResponse[T any] interface { Items() []T }
SimpleResponse is the interface for responses that contain a list of items but don't use pagination (return all items in a single response).