revert code

This commit is contained in:
WhiteBatman 2017-09-25 21:24:51 +08:00
parent a21b0243bd
commit e60236dae9
4 changed files with 11 additions and 13 deletions

View File

@ -1545,11 +1545,7 @@ func (engine *Engine) formatTime(sqlTypeName string, t time.Time) (v interface{}
case core.Date:
v = t.Format("2006-01-02")
case core.DateTime, core.TimeStamp:
v = t.Format("2006-01-02 15:04:05.999")
if engine.dialect.DBType() == "sqlite3" {
v = t.UTC().Format("2006-01-02 15:04:05.999")
}
v = t.Format("2006-01-02 15:04:05")
case core.TimeStampz:
if engine.dialect.DBType() == core.MSSQL {
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")

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.
//
// 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")
sqlArgs := SqlArgs{
query: query,
@ -454,11 +454,16 @@ func (ges *GESession) Sql(query interface{}, args ...interface{}) *GESession {
return ges
}
type SQLArgs struct {
query interface{}
args []interface{}
}
// 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.
func (ges *GESession) SQL(query interface{}, args ...interface{}) *GESession {
ges.operation = append(ges.operation, "SQL")
sqlArgs := SqlArgs{
sqlArgs := SQLArgs{
query: query,
args: args,
}
@ -577,7 +582,6 @@ func (ges *GESession) Exist(bean ...interface{}) (bool, error) {
return session.Exist(bean...)
}
//TODO 缺少前置session操作链
// Find retrieve records from table, condiBeans's non-empty fields
// are conditions. beans could be []Struct, []*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...)
}
//TODO 缺少前置session操作链
// Get retrieve one record from database, bean's non-empty fields
// will be as conditions
func (ges *GESession) Get(bean interface{}) (bool, error) {
@ -598,7 +601,6 @@ func (ges *GESession) Get(bean interface{}) (bool, error) {
return session.Get(bean)
}
//TODO 缺少前置session操作链
// Insert insert one or more beans
func (ges *GESession) Insert(beans ...interface{}) (int64, error) {
session := ges.ge.Master().NewSession()

View File

@ -167,11 +167,11 @@ func (ge *GroupEngine) NewGESession() *GESession {
}
type SqlArgs struct {
query interface{}
query string
args []interface{}
}
func (ge *GroupEngine) Sql(query interface{}, args ...interface{}) *GESession {
func (ge *GroupEngine) Sql(query string, args ...interface{}) *GESession {
ges := ge.NewGESession()
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.
//
// 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...)
}