You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
564 B
31 lines
564 B
|
7 years ago
|
package builder
|
||
|
8 years ago
|
|
||
|
|
type OrderPair struct {
|
||
|
7 years ago
|
Key string
|
||
|
|
Value string
|
||
|
8 years ago
|
}
|
||
|
|
|
||
|
|
type WherePair struct {
|
||
|
|
Query string
|
||
|
|
Args []interface{}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (this *WherePair) And(where *WherePair) *WherePair {
|
||
|
|
if this.Query == "" {
|
||
|
|
return where
|
||
|
|
} else {
|
||
|
|
return &WherePair{Query: this.Query + " AND " + where.Query, Args: append(this.Args, where.Args...)}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
func (this *WherePair) Or(where *WherePair) *WherePair {
|
||
|
|
if this.Query == "" {
|
||
|
|
return where
|
||
|
|
} else {
|
||
|
|
return &WherePair{Query: this.Query + " OR " + where.Query, Args: append(this.Args, where.Args...)}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|