mirror of
https://github.com/safing/portbase
synced 2025-09-09 22:05:49 +00:00
Finish query package for now
This commit is contained in:
parent
115b18dfb6
commit
e40d66e103
15 changed files with 714 additions and 181 deletions
|
@ -20,7 +20,7 @@ func newStringSliceCondition(key string, operator uint8, value interface{}) *str
|
|||
parsedValue := strings.Split(v, ",")
|
||||
if len(parsedValue) < 2 {
|
||||
return &stringSliceCondition{
|
||||
key: fmt.Sprintf("could not parse \"%s\" to []string", v),
|
||||
key: v,
|
||||
operator: errorPresent,
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,12 @@ func newStringSliceCondition(key string, operator uint8, value interface{}) *str
|
|||
operator: operator,
|
||||
value: parsedValue,
|
||||
}
|
||||
case []string:
|
||||
return &stringSliceCondition{
|
||||
key: key,
|
||||
operator: operator,
|
||||
value: v,
|
||||
}
|
||||
default:
|
||||
return &stringSliceCondition{
|
||||
key: fmt.Sprintf("incompatible value %v for []string", value),
|
||||
|
@ -60,5 +66,5 @@ func (c *stringSliceCondition) check() error {
|
|||
}
|
||||
|
||||
func (c *stringSliceCondition) string() string {
|
||||
return fmt.Sprintf("%s %s %s", c.key, getOpName(c.operator), strings.Join(c.value, ","))
|
||||
return fmt.Sprintf("%s %s %s", escapeString(c.key), getOpName(c.operator), escapeString(strings.Join(c.value, ",")))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue