kontext

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 2 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

A Config for Context creation

type Context

type Context interface {
	Ctx() context.Context
	Get(key string) (interface{}, bool)
	GetWithoutCheck(key string) interface{}
	Set(key string, val interface{})
}

Context in wrap default context implementation with Get and Set which can carry a value from one flow

type Kontext

type Kontext struct {
	// contains filtered or unexported fields
}

Kontext implement kontext.Context

func Fabricate

func Fabricate(opts ...Option) *Kontext

Fabricate Context

func (*Kontext) Ctx

func (k *Kontext) Ctx() context.Context

Ctx carried default built in context.Context

func (*Kontext) Get

func (k *Kontext) Get(key string) (interface{}, bool)

Get data from the context. It will return value and a boolean to indicate if the value is exists or not

func (*Kontext) GetWithoutCheck

func (k *Kontext) GetWithoutCheck(key string) interface{}

GetWithoutCheck will return value from the Context without returning boolean indicator if the value is exists or not

func (*Kontext) Set

func (k *Kontext) Set(key string, val interface{})

Set data in the context based on it's key value

type Option

type Option func(*Config)

Option when fabricating Context

func WithDefaultContext

func WithDefaultContext(ctx context.Context) Option

WithDefaultContext give kontext option to wrap current context with default context

Jump to

Keyboard shortcuts

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