revert code

This commit is contained in:
WhiteBatman 2017-09-25 21:24:51 +08:00 committed by Lunny Xiao
parent fb9b7b8a36
commit eaa5b37e0b
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
3 changed files with 10 additions and 8 deletions

View File

@ -444,7 +444,7 @@ func (ges *GESession) NoAutoTime() *GESession {
// and cannot use Where, Id, In and etc. Methods to describe, you can use SQL. // and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.
// //
// Deprecated: use SQL instead. // Deprecated: use SQL instead.
func (ges *GESession) Sql(query interface{}, args ...interface{}) *GESession { func (ges *GESession) Sql(query string, args ...interface{}) *GESession {
ges.operation = append(ges.operation, "Sql") ges.operation = append(ges.operation, "Sql")
sqlArgs := SqlArgs{ sqlArgs := SqlArgs{
query: query, query: query,
@ -454,11 +454,16 @@ func (ges *GESession) Sql(query interface{}, args ...interface{}) *GESession {
return ges return ges
} }
type SQLArgs struct {
query interface{}
args []interface{}
}
// SQL provides raw sql input parameter. When you have a complex SQL statement // SQL provides raw sql input parameter. When you have a complex SQL statement
// and cannot use Where, Id, In and etc. Methods to describe, you can use SQL. // and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.
func (ges *GESession) SQL(query interface{}, args ...interface{}) *GESession { func (ges *GESession) SQL(query interface{}, args ...interface{}) *GESession {
ges.operation = append(ges.operation, "SQL") ges.operation = append(ges.operation, "SQL")
sqlArgs := SqlArgs{ sqlArgs := SQLArgs{
query: query, query: query,
args: args, args: args,
} }
@ -577,7 +582,6 @@ func (ges *GESession) Exist(bean ...interface{}) (bool, error) {
return session.Exist(bean...) return session.Exist(bean...)
} }
//TODO 缺少前置session操作链
// Find retrieve records from table, condiBeans's non-empty fields // Find retrieve records from table, condiBeans's non-empty fields
// are conditions. beans could be []Struct, []*Struct, map[int64]Struct // are conditions. beans could be []Struct, []*Struct, map[int64]Struct
// map[int64]*Struct // map[int64]*Struct
@ -588,7 +592,6 @@ func (ges *GESession) Find(rowsSlicePtr interface{}, condiBean ...interface{}) e
return session.Find(rowsSlicePtr, condiBean...) return session.Find(rowsSlicePtr, condiBean...)
} }
//TODO 缺少前置session操作链
// Get retrieve one record from database, bean's non-empty fields // Get retrieve one record from database, bean's non-empty fields
// will be as conditions // will be as conditions
func (ges *GESession) Get(bean interface{}) (bool, error) { func (ges *GESession) Get(bean interface{}) (bool, error) {
@ -598,7 +601,6 @@ func (ges *GESession) Get(bean interface{}) (bool, error) {
return session.Get(bean) return session.Get(bean)
} }
//TODO 缺少前置session操作链
// Insert insert one or more beans // Insert insert one or more beans
func (ges *GESession) Insert(beans ...interface{}) (int64, error) { func (ges *GESession) Insert(beans ...interface{}) (int64, error) {
session := ges.ge.Master().NewSession() session := ges.ge.Master().NewSession()

View File

@ -167,11 +167,11 @@ func (ge *GroupEngine) NewGESession() *GESession {
} }
type SqlArgs struct { type SqlArgs struct {
query interface{} query string
args []interface{} args []interface{}
} }
func (ge *GroupEngine) Sql(query interface{}, args ...interface{}) *GESession { func (ge *GroupEngine) Sql(query string, args ...interface{}) *GESession {
ges := ge.NewGESession() ges := ge.NewGESession()
return ges.Sql(query, args...) return ges.Sql(query, args...)
} }

View File

@ -10,7 +10,7 @@ import "github.com/go-xorm/builder"
// and cannot use Where, Id, In and etc. Methods to describe, you can use SQL. // and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.
// //
// Deprecated: use SQL instead. // Deprecated: use SQL instead.
func (session *Session) Sql(query interface{}, args ...interface{}) *Session { func (session *Session) Sql(query string, args ...interface{}) *Session {
return session.SQL(query, args...) return session.SQL(query, args...)
} }