rpc

package
v1.249.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(mu *http.ServeMux, en *encoding.Map)

Register for HTTP.

func Request added in v1.244.0

func Request(ctx context.Context) *http.Request

Request for rpc.

func Response added in v1.244.0

func Response(ctx context.Context) http.ResponseWriter

Response for rpc.

func Unary added in v1.244.0

func Unary[Req any, Res any](path string, handler UnaryHandler[Req, Res])

Unary for rpc.

func WithRequest added in v1.244.0

func WithRequest(ctx context.Context, r *http.Request) context.Context

WithRequest for rpc.

func WithResponse added in v1.244.0

func WithResponse(ctx context.Context, r http.ResponseWriter) context.Context

WithResponse for rpc.

func WriteError added in v1.241.0

func WriteError(ctx context.Context, err error)

WriteError for rpc.

Types

type Client

type Client[Req any, Res any] struct {
	// contains filtered or unexported fields
}

Client for HTTP.

func NewClient

func NewClient[Req any, Res any](url, contentType string, client *http.Client, enc *encoding.Map) *Client[Req, Res]

NewClient for HTTP.

func (*Client[Req, Res]) Call

func (c *Client[Req, Res]) Call(ctx context.Context, req *Req) (res *Res, err error)

Call for HTTP.

type UnaryHandler added in v1.244.0

type UnaryHandler[Req any, Res any] func(ctx context.Context, req *Req) (*Res, error)

UnaryHandler for rpc.

Jump to

Keyboard shortcuts

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