metadata

package
v2.9.5 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

Package metadata is a way of defining message headers

Package metadata is a way of defining message headers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, k string) context.Context

Delete key from metadata

func Get

func Get(ctx context.Context, key string) (string, bool)

Get returns a single value from metadata in the context

func MergeContext

func MergeContext(ctx context.Context, patchMd Metadata, overwrite bool) context.Context

MergeContext merges metadata to existing metadata, overwriting if specified

func NewContext deprecated

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

NewContext creates a new context with the given metadata

Deprecated: use NewIncomingContext or NewOutgoingContext

func NewIncomingContext added in v2.9.5

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

NewIncomingContext creates a new context with incoming metadata attached

func NewOutgoingContext added in v2.9.5

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

NewOutgoingContext creates a new context with outcoming metadata attached

func Set

func Set(ctx context.Context, k, v string) context.Context

Set add key with val to metadata

func SetIncomingContext added in v2.9.5

func SetIncomingContext(ctx context.Context, md Metadata) bool

SetIncomingContext modify incoming context with given metadata

func SetOutgoingContext added in v2.9.5

func SetOutgoingContext(ctx context.Context, md Metadata) bool

SetOutgoingContext modify outgoing context with given metadata

Types

type Metadata

type Metadata map[string]string

Metadata is our way of representing request headers internally. They're used at the RPC level and translate back and forth from Transport headers.

func Copy

func Copy(md Metadata) Metadata

Copy makes a copy of the metadata

func FromContext deprecated

func FromContext(ctx context.Context) (Metadata, bool)

FromContext returns metadata from the given context returned metadata shoud not be modified or race condition happens

Deprecated: use FromIncomingContext or FromOutgoingContext

func FromIncomingContext added in v2.9.5

func FromIncomingContext(ctx context.Context) (Metadata, bool)

FromIncomingContext returns metadata from incoming ctx returned metadata shoud not be modified or race condition happens

func FromOutgoingContext added in v2.9.5

func FromOutgoingContext(ctx context.Context) (Metadata, bool)

FromOutgoingContext returns metadata from outgoing ctx returned metadata shoud not be modified or race condition happens

func (Metadata) Delete

func (md Metadata) Delete(key string)

func (Metadata) Get

func (md Metadata) Get(key string) (string, bool)

func (Metadata) Set

func (md Metadata) Set(key, val string)

Jump to

Keyboard shortcuts

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