config

package
v0.0.0-...-21311fb Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

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
}

func New

func New() *Config

func (*Config) Add

func (c *Config) Add(key string, fn ConfigFn, defaults interface{})

Add adds new entry to configuration

func (*Config) Parse

func (c *Config) Parse(args []string) (fns TestSet, err error)

Parse will take list of function=JSON, base config map, and return list of initialized test functions to run

type ConfigFn

type ConfigFn func(param interface{}) (gravity.TestFunc, error)

ConfigFn is a function which takes default parameters and returns a pre-configured test function

type Entry

type Entry struct {
	TestFunc gravity.TestFunc `json:"-"`
	Param    interface{}
}

Entry is a pair of initialized test function and its parameters

type TestSet

type TestSet map[string]Entry

type Timeout

type Timeout struct {
	time.Duration
}

Timeout provides "human" json serialization/deserialization such as "1m" or "1h" for time.Duration.

For further information, see:

https://github.com/golang/go/issues/10275
https://stackoverflow.com/questions/48050945/how-to-unmarshal-json-into-durations

func (Timeout) MarshalJSON

func (d Timeout) MarshalJSON() ([]byte, error)

func (*Timeout) UnmarshalJSON

func (d *Timeout) UnmarshalJSON(buf []byte) error

Jump to

Keyboard shortcuts

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