connectgrpc

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneRequest

func CloneRequest[Req any](base *connect.Request[Req], msg *Req) *connect.Request[Req]

func CodeToHTTP

func CodeToHTTP(code connect.Code) int32

func HTTPToCode

func HTTPToCode(httpCode int32) connect.Code

func HandleUnary

func HandleUnary[Req any, Res any](ctx context.Context, req *httpgrpc.HTTPRequest, u UnaryHandler[Req, Res]) (*httpgrpc.HTTPResponse, error)

func NewClient

func NewClient(transport GRPCRoundTripper) connect.HTTPClient

func ProcedureFromContext

func ProcedureFromContext(ctx context.Context) string

func RoundTripUnary

func RoundTripUnary[Req any, Res any](ctx context.Context, rt GRPCRoundTripper, in *connect.Request[Req]) (*connect.Response[Res], error)

func WithProcedure

func WithProcedure(ctx context.Context, u string) context.Context

Types

type GRPCHandler

type GRPCHandler interface {
	Handle(ctx context.Context, req *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error)
}

func NewHandler

func NewHandler(h http.Handler) GRPCHandler

type GRPCRoundTripper

type GRPCRoundTripper interface {
	RoundTripGRPC(ctx context.Context, req *httpgrpc.HTTPRequest) (*httpgrpc.HTTPResponse, error)
}

type UnaryHandler

type UnaryHandler[Req any, Res any] func(context.Context, *connect.Request[Req]) (*connect.Response[Res], error)

Jump to

Keyboard shortcuts

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