Help us shape the future of Go! Take the 2026 Go Developer Survey

rpccontext

package
v0.510.3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientFromContext

func ClientFromContext[Client Pingable[Req, Resp, RespPtr], Req any, Resp any, RespPtr PingResponse[Resp]](ctx context.Context) Client

ClientFromContext returns the given RPC client from the context, or panics.

func ContextWithClient

func ContextWithClient[Client Pingable[Req, Resp, RespPtr], Req any, Resp any, RespPtr PingResponse[Resp]](ctx context.Context, client Client) context.Context

ContextWithClient returns a context with an RPC client attached.

func IsClientAvailableInContext

func IsClientAvailableInContext[Client Pingable[Req, Resp, RespPtr], Req any, Resp any, RespPtr PingResponse[Resp]](ctx context.Context) bool

Types

type PingResponse

type PingResponse[T any] interface {
	*T
	GetNotReady() string
}

type Pingable

type Pingable[Req any, Resp any, RespPtr PingResponse[Resp]] interface {
	Ping(ctx context.Context, req *connect.Request[Req]) (*connect.Response[Resp], error)
}

Jump to

Keyboard shortcuts

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