cfg

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// ReplErrStr represents error replacement string.
	ReplErrStr string = "ERROR_REPLACEMENT"
)

Variables

This section is empty.

Functions

func Contains

func Contains(arr []string, s string) bool

Contains returns true if a value is in a slice.

func DecodeArgs

func DecodeArgs(s string) ([]string, error)

DecodeArgs decode arguments from string.

func DedupStrArr

func DedupStrArr(arr []string) []string

DedupStrArr returns deduplicated string array.

func EncodeArgs

func EncodeArgs(args []string) string

EncodeArgs encodes passed arguments.

func FindStrArr

func FindStrArr(arr []string, s string) bool

FindStrArr returns true if a string found in a slice.

func ParseBoolArg

func ParseBoolArg(s string) (bool, error)

ParseBoolArg converts string to boolean.

func ValidateArg

func ValidateArg(rules map[string]*ArgRule, k string, v []string) error

ValidateArg performs argument validation.

Types

type ArgRule

type ArgRule struct {
	Min int `json:"min,omitempty" xml:"min,omitempty" yaml:"min,omitempty"`
	Max int `json:"max,omitempty" xml:"max,omitempty" yaml:"max,omitempty"`
}

ArgRule represents a rules that applies to an arguments passed in a config.

Jump to

Keyboard shortcuts

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