Merge e5a5441067
into 24c1f3c15a
This commit is contained in:
commit
3087587a3d
|
@ -541,6 +541,12 @@ func (engine *Engine) Cols(columns ...string) *Session {
|
|||
return session.Cols(columns...)
|
||||
}
|
||||
|
||||
func (engine *Engine) RawCols(columns ...string) *Session {
|
||||
session := engine.NewSession()
|
||||
session.IsAutoClose = true
|
||||
return session.RawCols(columns...)
|
||||
}
|
||||
|
||||
func (engine *Engine) AllCols() *Session {
|
||||
session := engine.NewSession()
|
||||
session.IsAutoClose = true
|
||||
|
|
|
@ -201,6 +201,12 @@ func (session *Session) Cols(columns ...string) *Session {
|
|||
return session
|
||||
}
|
||||
|
||||
// Method RawCols adds Cols without quotes
|
||||
func (session *Session) RawCols(columns ...string) *Session {
|
||||
session.Statement.RawCols(columns...)
|
||||
return session
|
||||
}
|
||||
|
||||
func (session *Session) AllCols() *Session {
|
||||
session.Statement.AllCols()
|
||||
return session
|
||||
|
|
10
statement.go
10
statement.go
|
@ -864,6 +864,16 @@ func (statement *Statement) Cols(columns ...string) *Statement {
|
|||
return statement
|
||||
}
|
||||
|
||||
// Generate "col1, col2" statement without quotes
|
||||
func (statement *Statement) RawCols(columns ...string) *Statement {
|
||||
newColumns := col2NewCols(columns...)
|
||||
for _, nc := range newColumns {
|
||||
statement.columnMap[strings.ToLower(nc)] = true
|
||||
}
|
||||
statement.ColumnStr = strings.Join(newColumns, ", ")
|
||||
return statement
|
||||
}
|
||||
|
||||
// Update use only: update all columns
|
||||
func (statement *Statement) AllCols() *Statement {
|
||||
statement.useAllCols = true
|
||||
|
|
Loading…
Reference in New Issue