grpc

package
v0.0.0-...-8d237ee Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package grpc provides getters and setters for gRPC data on our context object.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetMetadata

func SetMetadata(ctx context.Context, md Metadata) context.Context

SetRPCMetadata attaches RPCMetadata to the context. This will normally be set by the middleware and correspond to a specific operation in grpc or http. This can be used to do things like cause traces to occur for an operation.

Types

type Metadata

type Metadata struct {
	// CustomerID is the customer ID for the call. This is set by the customer.
	CustomerID string
	// CallID is a unique identifier for the call. This is set by an interceptor.
	CallID string
	// Op represents the operation being performed. This is the method being
	// called in gRPC. This is set by an interceptor.
	Op string
}

Metadata is a struct that contains metadata about an RPC call.

func GetMetadata

func GetMetadata(ctx context.Context) Metadata

GetMetadata returns the RPCMetadata attached to the context. If no RPCMetadata is attached, it returns the zero value.

func (Metadata) IsZero

func (r Metadata) IsZero() bool

IsZero returns true if the RPCMetadata is the zero value.

Jump to

Keyboard shortcuts

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