Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
b24dba9a45
|
|||
cfbc20367d
|
|||
e25912758e
|
@@ -74,7 +74,7 @@ func processEnvOverrides(rval reflect.Value, delim string, prefix string) error
|
|||||||
|
|
||||||
rvfield.Set(reflect.ValueOf(envval))
|
rvfield.Set(reflect.ValueOf(envval))
|
||||||
|
|
||||||
fmt.Printf("[CONF] Overwrite config '%s' () with '%s'\n", fullEnvKey, envval)
|
fmt.Printf("[CONF] Overwrite config '%s' with '%s'\n", fullEnvKey, envval)
|
||||||
|
|
||||||
} else if rvfield.Type() == reflect.TypeOf(int(0)) {
|
} else if rvfield.Type() == reflect.TypeOf(int(0)) {
|
||||||
|
|
||||||
|
@@ -34,3 +34,7 @@ func IsNil(i interface{}) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PtrEquals[T comparable](v1 *T, v2 *T) bool {
|
||||||
|
return (v1 == nil && v2 == nil) || (v1 != nil && v2 != nil && *v1 == *v2)
|
||||||
|
}
|
||||||
|
@@ -8,6 +8,7 @@ type Regex interface {
|
|||||||
MatchAll(haystack string) []RegexMatch
|
MatchAll(haystack string) []RegexMatch
|
||||||
ReplaceAll(haystack string, repl string, literal bool) string
|
ReplaceAll(haystack string, repl string, literal bool) string
|
||||||
ReplaceAllFunc(haystack string, repl func(string) string) string
|
ReplaceAllFunc(haystack string, repl func(string) string) string
|
||||||
|
RemoveAll(haystack string) string
|
||||||
GroupCount() int
|
GroupCount() int
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +72,10 @@ func (w *regexWrapper) ReplaceAllFunc(haystack string, repl func(string) string)
|
|||||||
return w.rex.ReplaceAllStringFunc(haystack, repl)
|
return w.rex.ReplaceAllStringFunc(haystack, repl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *regexWrapper) RemoveAll(haystack string) string {
|
||||||
|
return w.rex.ReplaceAllLiteralString(haystack, "")
|
||||||
|
}
|
||||||
|
|
||||||
// GroupCount returns the amount of groups in this match, does not count group-0 (whole match)
|
// GroupCount returns the amount of groups in this match, does not count group-0 (whole match)
|
||||||
func (w *regexWrapper) GroupCount() int {
|
func (w *regexWrapper) GroupCount() int {
|
||||||
return len(w.subnames) - 1
|
return len(w.subnames) - 1
|
||||||
|
Reference in New Issue
Block a user