Refine the rest structure.
This commit is contained in:
30
code/tool/builder/sql_builder.go
Normal file
30
code/tool/builder/sql_builder.go
Normal file
@ -0,0 +1,30 @@
|
||||
package builder
|
||||
|
||||
type OrderPair struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
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...)}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user