top

Package xcon check and fill default value based on struct tags, also support custom check and fill method.

Supported method (within xcon tag):

nonzero
	check for zero value

env = STRING
	if value is zero, fill with environment variable

default = STRING
	if value is zero, fill value with provided string

val = STR
	string equality check

val (>|<|>=|<=|<>|=) NUM
	compare scalar value
	value type: builtin scalar types

(max|min) = NUM
	identical to val (<=|>=) NUM

len (>|<|>=|<=|<>|=) INT
	len check
	value type: array, slice, map, string

cap (>|<|>=|<=|<>|=) INT
	cap check
	value type: slice, chan

enum = STRING1|STRING2|...
	enum check
	value type: string

re = STRING
	regexp check
	value type: string

To implement custom check and fill logic, just implement the 'Checker' interface.

Imports 1 package(s)

  1. gopkg.in/yaml.v2

Test imports 1 package(s)

  1. github.com/csyangchen/xcon