mirror of
https://github.com/safing/portbase
synced 2025-09-16 18:19:50 +00:00
Add first part of query parser / Finish query building
This commit is contained in:
parent
6ed50f34fb
commit
115b18dfb6
17 changed files with 337 additions and 66 deletions
|
@ -1,5 +1,10 @@
|
|||
package query
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// And combines multiple conditions with a logical _AND_ operator.
|
||||
func And(conditions ...Condition) Condition {
|
||||
return &andCond{
|
||||
|
@ -29,3 +34,11 @@ func (c *andCond) check() (err error) {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *andCond) string() string {
|
||||
var all []string
|
||||
for _, cond := range c.conditions {
|
||||
all = append(all, cond.string())
|
||||
}
|
||||
return fmt.Sprintf("(%s)", strings.Join(all, " and "))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue