metadata

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestIDKey = "requestId"
	AccountIDKey = "accountId"
	UserIDKey    = "userId"
	EmailKey     = "email"
	FirstNameKey = "firstName"
	LastNameKey  = "lastName"
	TypeKey      = "type"
	SubTypeKey   = "subType"
	RolesKey     = "roles"
	InternalKey  = "internal"
)

Variables

This section is empty.

Functions

func GetFromContext

func GetFromContext(ctx context.Context, key string) string

func HasRole

func HasRole(ctx context.Context, role string) bool

HasRole returns true if the given role string occurs in metadata.roles

func NewContext

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

func NewOutgoingContext

func NewOutgoingContext(ctx context.Context) context.Context

func NewRequestID

func NewRequestID() string

Types

type Metadata

type Metadata map[string]string

Metadata is the internal metadata abstraction. It is used to provide a single way of handling metadata throughout different transport layers (gRPC, HTTP, AMQP, ...).

func FromContext

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

Jump to

Keyboard shortcuts

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