diff --git a/expression_ext.go b/expression_ext.go index c42ca7c9..eae33f46 100644 --- a/expression_ext.go +++ b/expression_ext.go @@ -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 + ")" }