Expresions: added CAO and LAO (alias optional)
This commit is contained in:
parent
9235aea183
commit
77fc126a0d
@ -65,6 +65,13 @@ func (db *DB) LA(model interface{}, alias string, name string) *expr {
|
|||||||
return &expr{expr: scope.Quote(alias) + "." + scope.Quote(field.DBName)}
|
return &expr{expr: scope.Quote(alias) + "." + scope.Quote(field.DBName)}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *DB) LAO(model interface{}, alias string, name string) *expr {
|
||||||
|
if alias == "" {
|
||||||
|
return db.L(model, name)
|
||||||
|
}
|
||||||
|
return db.LA(model, alias, name)
|
||||||
|
}
|
||||||
|
|
||||||
func (db *DB) QuoteExpr(table string, column string) *expr {
|
func (db *DB) QuoteExpr(table string, column string) *expr {
|
||||||
scope := db.NewScope(nil)
|
scope := db.NewScope(nil)
|
||||||
return &expr{expr: scope.Quote(table) + "." + scope.Quote(column)}
|
return &expr{expr: scope.Quote(table) + "." + scope.Quote(column)}
|
||||||
@ -92,6 +99,13 @@ func (db *DB) CA(model interface{}, alias string, names ...string) string {
|
|||||||
return strings.Join(columns, ", ")
|
return strings.Join(columns, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *DB) CAO(model interface{}, alias string, names ...string) string {
|
||||||
|
if alias == "" {
|
||||||
|
return db.CQ(model, names...)
|
||||||
|
}
|
||||||
|
return db.CA(model, alias, names...)
|
||||||
|
}
|
||||||
|
|
||||||
func (db *DB) CQ(model interface{}, names ...string) string {
|
func (db *DB) CQ(model interface{}, names ...string) string {
|
||||||
columns := make([]string, 0)
|
columns := make([]string, 0)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user