-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwherer.go
More file actions
30 lines (25 loc) · 780 Bytes
/
wherer.go
File metadata and controls
30 lines (25 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package pagefilter
// Wherer is an interface that can be used to specify the WHERE clause to use. By using this interface,
// the package will default to using an "AND" WHERE clause. If you want to use an "OR" WHERE clause, you can
// use the WhereTyper interface instead.
type Wherer interface {
Where() (string, []any)
}
// WhereTyper is an interface that can be used to specify the type of WHERE clause to use. By using this
// interface, you can specify whether to use an "AND" or "OR" WHERE clause.
type WhereTyper interface {
Wherer
WhereType() WhereType
}
type WhereType string
const (
WhereTypeAnd WhereType = "AND"
WhereTypeOr WhereType = "OR"
)
func (w WhereType) IsValid() bool {
switch w {
case WhereTypeAnd, WhereTypeOr:
return true
}
return false
}