context

package
v3.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: Apache-2.0 Imports: 0 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// UserId is the the id of the user.
	UserId string

	// SessionId is the id of the session.
	SessionId string

	// RemoteAddress is the IP address of the machine.
	RemoteAddress string

	// Environment is the environment this application is running in.
	Environment string

	// AppName is the application name.
	AppName string

	// CurrentTime is used for date constraints. Defaults to time.Now if not set.
	CurrentTime string

	// Properties is a map of additional properties.
	Properties map[string]string
}

Context specifies the context in which a feature toggle should be considered to be enabled or not.

func (Context) Field added in v3.1.0

func (ctx Context) Field(name string) string

Field allows accessing the fields of the context by name. The typed fields are searched first and if nothing matches, it will search the properties.

func (Context) Override added in v3.1.0

func (ctx Context) Override(src Context) *Context

Override will take all non-empty values in 'src' and replace the corresponding values in this context with those.

Jump to

Keyboard shortcuts

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