Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind converts a string to a reflect.Value based on its kind.
It supports basic types (string, int, uint, float, bool, duration) and slices of strings.
Example:
var x int err := reflectutil.Bind(reflect.ValueOf(&x).Elem(), "42")
func BindStruct ¶
BindStruct populates a struct from a map[string]string using `conf` tags or field names.
Example:
type Config struct {
Name string `conf:"name"`
Count int `conf:"count"`
}
var cfg Config
err := reflectutil.BindStruct(&cfg, map[string]string{"name": "test", "count": "42"})
func ParseBoolExtended ¶
ParseBoolExtended parses a boolean string with support for more formats than strconv.ParseBool.
It accepts 1, t, true, yes, y, on as true. It accepts 0, f, false, no, n, off as false.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.