Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForEach ¶
func ForEach[T any](streamClient StreamClient[T], openError error, handler ResponseHandler[T]) error
ForEach loops on the stream Recv() methods with proper error checking. The stream opening error is also checked first.
func MustStreamOne ¶
func MustStreamOne[T any](streamClient StreamClient[T], openError error) (T, bool, error)
MustStreamOne is a shortcut to call for each and get first result.
Types ¶
type ResponseHandler ¶
type StreamClient ¶
type StreamClient[T any] interface { grpc.ClientStream Recv() (T, error) }
type StreamClientWrapper ¶
type StreamClientWrapper[T any] interface { ForEach(handler ResponseHandler[T]) error }
func WrapStream ¶
func WrapStream[T any](sc StreamClient[T]) StreamClientWrapper[T]
WrapStream wraps a grpc stream client to add ForEach method
Click to show internal directories.
Click to hide internal directories.