config

package
v0.0.0-...-1509d7a Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package config is config.

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextValueTestName util.ContextKey = "test_name"
	ContextValueLogDir   util.ContextKey = "log_dir"
	ContextValueLog      util.ContextKey = "log"
	ContextValueDesign   util.ContextKey = "design"
	ContextValueVars     util.ContextKey = "vars"
	ContextValueHosts    util.ContextKey = "hosts"
	ContextValueFlags    util.ContextKey = "flags"
)
View Source
var TranslateWords = map[string]string{
	"ssh": "SSH",
	"id":  "ID",
	"url": "URL",
	"uri": "URI",
}

Functions

func CheckMongodbURI

func CheckMongodbURI(uri string) (connstring.ConnString, error)

func CompileTemplate

func CompileTemplate(s string, vars *Vars) ([]byte, error)

func CopyValue

func CopyValue(i interface{}) interface{}

func IsTemplateCondition

func IsTemplateCondition(s string) bool

func LoadDesignContextValue

func LoadDesignContextValue(ctx context.Context, l *Design) error

func LoadFlagsContextValue

func LoadFlagsContextValue(ctx context.Context, l *map[string]interface{}) error

func LoadLogContextValue

func LoadLogContextValue(ctx context.Context, l **logging.Logging) error

func LoadLogDirContextValue

func LoadLogDirContextValue(ctx context.Context, l *string) error

func LoadTestNameContextValue

func LoadTestNameContextValue(ctx context.Context, l *string) error

func LoadVarsContextValue

func LoadVarsContextValue(ctx context.Context, l **Vars) error

func MergeItem

func MergeItem(a, b interface{}) (map[string]interface{}, error)

func NormalizeVarsKey

func NormalizeVarsKey(s string) string

func ParseConditionQuery

func ParseConditionQuery(s string) (bson.M, error)

func SanitizeVarsMap

func SanitizeVarsMap(m interface{}) interface{}

func ULID

func ULID() ulid.ULID

Types

type Design

type Design struct {
	StorageString    string
	Storage          connstring.ConnString `json:"-"`
	Hosts            []DesignHost
	NodeConfig       map[string]string
	CommonNodeConfig string
	NodesConfig      string
	Sequences        []DesignSequence
	ExitOnError      bool
	Skip             bool
}

func (*Design) IsValid

func (de *Design) IsValid([]byte) error

func (*Design) SetDatabase

func (de *Design) SetDatabase(s string) error

type DesignAction

type DesignAction struct {
	Name  string
	Args  []string
	Extra map[string]interface{}
}

func (DesignAction) IsEmpty

func (de DesignAction) IsEmpty() bool

func (*DesignAction) IsValid

func (de *DesignAction) IsValid([]byte) error

type DesignActionYAML

type DesignActionYAML struct {
	Name  *string
	Args  *[]string
	Extra map[string]interface{} `yaml:",inline"`
}

func (DesignActionYAML) Merge

func (de DesignActionYAML) Merge() (DesignAction, error)

type DesignCondition

type DesignCondition struct {
	Query   string
	Storage string
	Col     string
}

func (*DesignCondition) IsValid

func (de *DesignCondition) IsValid([]byte) error

type DesignConditionYAML

type DesignConditionYAML struct {
	Query   *string `yaml:"query"`
	Storage *string `yaml:"storage,omitempty"`
	Col     *string `yaml:"col,omitempty"`
}

func (DesignConditionYAML) Merge

type DesignHost

type DesignHost struct {
	Weight uint // if 0 weight, this host will be ignored.
	Host   string
	Local  bool
	SSH    DesignHostSSH
}

func (*DesignHost) IsValid

func (de *DesignHost) IsValid([]byte) error

type DesignHostSSH

type DesignHostSSH struct {
	Host string
	User string
	Key  string
}

func (*DesignHostSSH) IsValid

func (de *DesignHostSSH) IsValid([]byte) error

type DesignHostSSHYAML

type DesignHostSSHYAML struct {
	Host *string
	User *string
	Key  *string
}

func (DesignHostSSHYAML) Merge

func (de DesignHostSSHYAML) Merge() (DesignHostSSH, error)

type DesignHostYAML

type DesignHostYAML struct {
	Weight *uint
	Local  *bool
	Host   *string
	SSH    *DesignHostSSHYAML
}

func (DesignHostYAML) Merge

func (de DesignHostYAML) Merge() (DesignHost, error)

type DesignRegister

type DesignRegister struct {
	Type DesignRegisterType
	To   string
}

func (DesignRegister) IsEmpty

func (de DesignRegister) IsEmpty() bool

func (*DesignRegister) IsValid

func (de *DesignRegister) IsValid([]byte) error

type DesignRegisterType

type DesignRegisterType string
const (
	RegisterLastMatchType DesignRegisterType = "last_match"
)

func (DesignRegisterType) IsValid

func (t DesignRegisterType) IsValid([]byte) error

type DesignRegisterYAML

type DesignRegisterYAML struct {
	Type *string `yaml:"type"`
	To   *string `yaml:"to"`
}

func (DesignRegisterYAML) Merge

func (de DesignRegisterYAML) Merge() (DesignRegister, error)

type DesignSequence

type DesignSequence struct {
	Condition DesignCondition
	Action    DesignAction
	Register  DesignRegister
}

func (*DesignSequence) IsValid

func (de *DesignSequence) IsValid([]byte) error

type DesignSequenceYAML

type DesignSequenceYAML struct {
	Condition interface{}
	Action    *DesignActionYAML   `yaml:",omitempty"`
	Register  *DesignRegisterYAML `yaml:"register,omitempty"`
}

func (DesignSequenceYAML) Merge

func (de DesignSequenceYAML) Merge() (DesignSequence, error)

type DesignYAML

type DesignYAML struct {
	Storage     *string
	Hosts       []*DesignHostYAML
	NodeConfig  map[string]interface{} `yaml:"node-config"`
	NodesConfig *string                `yaml:"nodes-config"`
	Sequences   []*DesignSequenceYAML
	ExitOnError *bool `yaml:"exit-on-error"`
	Skip        *bool
}

func (DesignYAML) Merge

func (de DesignYAML) Merge() (Design, error)

type Vars

type Vars struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewVars

func NewVars(m map[string]interface{}) *Vars

func (*Vars) AddFunc

func (vs *Vars) AddFunc(name string, f interface{}) *Vars

func (*Vars) Clone

func (vs *Vars) Clone(m map[string]interface{}) *Vars

func (*Vars) Exists

func (vs *Vars) Exists(keys string) bool

func (*Vars) FuncMap

func (vs *Vars) FuncMap() template.FuncMap

func (*Vars) Map

func (vs *Vars) Map() map[string]interface{}

func (*Vars) Set

func (vs *Vars) Set(keys string, value interface{})

func (*Vars) Value

func (vs *Vars) Value(keys string) (interface{}, bool)

Jump to

Keyboard shortcuts

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