app_feature

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConsoleLogLevel

func ConsoleLogLevel(test, debug bool) esl.Level

func OptInAgreement

func OptInAgreement(v OptIn) app_msg.Message

func OptInDescription

func OptInDescription(v OptIn) app_msg.Message

func OptInDisclaimer

func OptInDisclaimer(v OptIn) app_msg.Message

func OptInFrom

func OptInFrom(v map[string]interface{}, oi OptIn) error

func OptInName

func OptInName(v OptIn) string

Types

type Feature

type Feature interface {
	IsProduction() bool
	IsDebug() bool
	IsVerbose() bool
	IsTest() bool
	IsTestWithMock() bool
	IsTestWithSeqReplay() (replay []nw_replay.Response, enabled bool)
	IsTestWithReplay() (replay kv_storage.Storage, enabled bool)
	IsQuiet() bool
	IsSecure() bool
	IsAutoOpen() bool
	IsTransient() bool

	// Is the experiment enabled or not.
	Experiment(name string) bool

	// UI format
	UIFormat() string

	// Concurrency configuration.
	Concurrency() int

	// Toolbox home path. Returns empty if a user doesn't specify the path.
	Home() string

	// Budget for memory usage
	BudgetMemory() app_budget.Budget

	// Budget for storage usage
	BudgetStorage() app_budget.Budget

	// Retrieve feature
	OptInGet(oi OptIn) (f OptIn, found bool)

	// Update opt-in feature
	OptInUpdate(oi OptIn) error

	// With test mode
	AsTest(useMock bool) Feature

	// With sequential replay test
	AsSeqReplayTest(replay []nw_replay.Response) Feature

	// With replay test
	AsReplayTest(replays kv_storage.Storage) Feature

	// With quiet mode, but this will not guarantee UI/log are converted into quiet mode.
	AsQuiet() Feature

	// Console log level
	ConsoleLogLevel() esl.Level

	// Extra options
	Extra() app_opt.ExtraOpts
}

type OptIn

type OptIn interface {
	// The timestamp of opt-in, in ISO8601 format.
	// Empty when the user is not yet agreed.
	OptInTimestamp() string

	// Name of the user who opt'ed in.
	OptInUser() string

	// True when this feature enabled.
	OptInIsEnabled() bool

	// Opt-in
	OptInCommit(enable bool)
}

type OptInStatus

type OptInStatus struct {
	// The timestamp of opt-in, in ISO8601 format.
	Timestamp string `json:"timestamp"`

	// Name of the user who opt'ed in
	User string `json:"user"`

	// Opt-in status.
	Status bool `json:"status"`
}

func (*OptInStatus) OptInCommit

func (z *OptInStatus) OptInCommit(enable bool)

func (OptInStatus) OptInIsEnabled

func (z OptInStatus) OptInIsEnabled() bool

func (OptInStatus) OptInTimestamp

func (z OptInStatus) OptInTimestamp() string

func (OptInStatus) OptInUser

func (z OptInStatus) OptInUser() string

Jump to

Keyboard shortcuts

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