go_sysutils/envs/consts.go

34 lines
846 B
Go
Raw Normal View History

package envs
import (
2021-12-18 04:41:09 -05:00
"regexp"
)
// Compiled regex patterns.
var (
2021-12-18 04:41:09 -05:00
reMaybeInt *regexp.Regexp = regexp.MustCompile(`^(?P<sign>\+|-)[0-9]+$`)
reMaybeFloat *regexp.Regexp = regexp.MustCompile(`(?P<sign>\+|-)?[0-9]+\.[0-9]+$`)
)
var (
StructTagInterpolate string = "envsub"
StructTagPopulate string = "envpop"
)
var (
defaultInterpolateOpts interpolateOpts = interpolateOpts{
noMapKey: false,
noMapVal: false,
}
// InterpolateOptNoMapKey is the equivalent of the struct tag `no_map_key` for Interpolate.
InterpolateOptNoMapKey optInterpolate = func(o *interpolateOpts) (err error) {
o.noMapKey = true
return
}
// InterpolateOptNoMapValue is the equivalent of the struct tag `no_map_value` for Interpolate.
InterpolateOptNoMapValue optInterpolate = func(o *interpolateOpts) (err error) {
o.noMapVal = true
return
}
)