Added funcs QuoteExpr and Min to expression extension
This commit is contained in:
parent
96758ec560
commit
968a09b86f
@ -60,6 +60,11 @@ func (db *DB) LA(model interface{}, alias string, name string) *expr {
|
||||
return &expr{expr: scope.Quote(alias) + "." + scope.Quote(field.DBName)}
|
||||
}
|
||||
|
||||
func (db *DB) QuoteExpr(table string, column string) *expr {
|
||||
scope := db.NewScope(nil)
|
||||
return &expr{expr: scope.Quote(table) + "." + scope.Quote(column)}
|
||||
}
|
||||
|
||||
func (db *DB) C(model interface{}, names ...string) string {
|
||||
columns := make([]string, 0)
|
||||
|
||||
@ -249,6 +254,10 @@ func (e *expr) Max() string {
|
||||
return "MAX(" + e.expr + ")"
|
||||
}
|
||||
|
||||
func (e *expr) Min() string {
|
||||
return "MIN(" + e.expr + ")"
|
||||
}
|
||||
|
||||
func (e *expr) Count() string {
|
||||
return "COUNT(" + e.expr + ")"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user