grpc

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ContentType = "application/grpc+proto"

ContentType is the Content-Type header value for gRPC requests.

Variables

This section is empty.

Functions

func AcceptHeader

func AcceptHeader() core.KeyVal[string]

AcceptHeader returns the Accept header for gRPC requests.

func Frame

func Frame(data []byte, compressed bool) []byte

Frame wraps message in gRPC length-prefixed format. Format: [compressed:1][length:4][data]

func Headers

func Headers() []core.KeyVal[string]

Headers returns the standard headers for gRPC requests.

func ReadFrame added in v0.17.0

func ReadFrame(r io.Reader) ([]byte, bool, error)

ReadFrame reads a single gRPC length-prefixed frame from the reader. Returns the message data, whether it was compressed, and any error. Returns io.EOF when the reader has no more data.

func Unframe

func Unframe(data []byte) ([]byte, bool, error)

Unframe extracts a gRPC length-prefixed message from the data. Returns the message data and whether it was compressed.

Types

type Code

type Code int

Code represents a gRPC status code.

const (
	OK                 Code = 0
	Canceled           Code = 1
	Unknown            Code = 2
	InvalidArgument    Code = 3
	DeadlineExceeded   Code = 4
	NotFound           Code = 5
	AlreadyExists      Code = 6
	PermissionDenied   Code = 7
	ResourceExhausted  Code = 8
	FailedPrecondition Code = 9
	Aborted            Code = 10
	OutOfRange         Code = 11
	Unimplemented      Code = 12
	Internal           Code = 13
	Unavailable        Code = 14
	DataLoss           Code = 15
	Unauthenticated    Code = 16
)

gRPC status codes.

func (Code) String

func (c Code) String() string

String returns the name of the status code.

type Status

type Status struct {
	Code    Code
	Message string
}

Status represents a gRPC status.

func ParseStatus

func ParseStatus(grpcStatus, grpcMessage string) *Status

ParseStatus parses gRPC status from HTTP trailers.

func (*Status) Error

func (s *Status) Error() string

func (*Status) OK

func (s *Status) OK() bool

OK returns true if the status represents success.

Jump to

Keyboard shortcuts

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