assistant

package
v0.0.0-...-6e51ac9 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFoundAssistant - couldn't find assistant in context.
	ErrNotFoundAssistant = errors.New("couldn't find assistant in context")
	// ErrNotValidAssistantKey - the error occurs if the assistant's technical key has been compromised.
	ErrNotValidAssistantKey = errors.New("not valid assistant key")
)

General assistant errors.

Functions

func GetValue

func GetValue[T any](ctx context.Context, key string) (result T)

GetValue - returns the value by key from Assistant according to the set type.

func GetValueOK

func GetValueOK[T any](ctx context.Context, key string) (result T, ok bool)

GetValueOK - returns the value by key from Assistant according to the set type.

func SetValue

func SetValue(ctx context.Context, key string, value any) bool

SetValue - returns counter by key from Assistant.

Types

type Assistant

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

Assistant - stores data_assistant about test settings and is able to place them in context.

func New

func New() *Assistant

New - returns an initialized Assistant.

func (*Assistant) Context

func (a *Assistant) Context(parent context.Context) context.Context

Context - applies the configuration to the parent context. * The parent context can be nil, then a new one will be created. * If the assistant already exists in the context, then the test will be taken from the * parent assistant and overwritten by the child.

func (*Assistant) NewContext

func (a *Assistant) NewContext() context.Context

NewContext - return context with assistant.

func (*Assistant) WithValue

func (a *Assistant) WithValue(key string, value any) *Assistant

func (*Assistant) WithValues

func (a *Assistant) WithValues(data map[string]any) *Assistant

Jump to

Keyboard shortcuts

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