rpccall

package
v0.0.72-alpha.65 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractField

func ExtractField[A, B, C any](ctx context.Context, fn func(ctx context.Context, req *A, opts ...grpc.CallOption) (*B, error), req *A, get func(*B) C, opts ...grpc.CallOption) (C, error)

ExtractField is a generic function that extracts a field from the response of a given function.

func Page

func Page[Req pagination, Resp any, Elem any](ctx context.Context, req Req, api func(ctx context.Context, req Req, opts ...grpc.CallOption) (*Resp, error), fn func(*Resp) []Elem, opts ...grpc.CallOption) ([]Elem, error)

Types

type RpcCaller

type RpcCaller[Req, Resp any] struct {
	// contains filtered or unexported fields
}

func NewRpcCaller

func NewRpcCaller[Req, Resp any](name string) RpcCaller[Req, Resp]

func (RpcCaller[Req, Resp]) Execute

func (r RpcCaller[Req, Resp]) Execute(ctx context.Context, req *Req, opts ...grpc.CallOption) error

func (RpcCaller[Req, Resp]) Invoke

func (r RpcCaller[Req, Resp]) Invoke(ctx context.Context, in *Req, opts ...grpc.CallOption) (*Resp, error)

func (RpcCaller[Req, Resp]) MethodName

func (r RpcCaller[Req, Resp]) MethodName() string

func (RpcCaller[Req, Resp]) SetConn

func (r RpcCaller[Req, Resp]) SetConn(conn *grpc.ClientConn)

Jump to

Keyboard shortcuts

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