revert code
This commit is contained in:
parent
a21b0243bd
commit
e60236dae9
|
@ -1545,11 +1545,7 @@ func (engine *Engine) formatTime(sqlTypeName string, t time.Time) (v interface{}
|
||||||
case core.Date:
|
case core.Date:
|
||||||
v = t.Format("2006-01-02")
|
v = t.Format("2006-01-02")
|
||||||
case core.DateTime, core.TimeStamp:
|
case core.DateTime, core.TimeStamp:
|
||||||
v = t.Format("2006-01-02 15:04:05.999")
|
v = t.Format("2006-01-02 15:04:05")
|
||||||
|
|
||||||
if engine.dialect.DBType() == "sqlite3" {
|
|
||||||
v = t.UTC().Format("2006-01-02 15:04:05.999")
|
|
||||||
}
|
|
||||||
case core.TimeStampz:
|
case core.TimeStampz:
|
||||||
if engine.dialect.DBType() == core.MSSQL {
|
if engine.dialect.DBType() == core.MSSQL {
|
||||||
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")
|
v = t.Format("2006-01-02T15:04:05.9999999Z07:00")
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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...)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue