metadata

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 4 Imported by: 1

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 added in v0.5.26

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 added in v0.5.7

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