replacements allow to replace multi values

This commit is contained in:
koba1t
2022-02-03 03:56:16 +09:00
parent b79d77a8a7
commit 22f9daa3ab
3 changed files with 72 additions and 6 deletions

View File

@@ -782,6 +782,13 @@ func IsListIndex(p string) bool {
return strings.HasPrefix(p, "[") && strings.HasSuffix(p, "]")
}
// IsIdxNumber returns true if p is an index number.
// e.g. 1
func IsIdxNumber(p string) bool {
idx, err := strconv.Atoi(p)
return err == nil && idx >= 0
}
// SplitIndexNameValue splits a lookup part Val index into the field name
// and field value to match.
// e.g. splits [name=nginx] into (name, nginx)