Merge 8b5de8cf1d
into b19177f4dc
This commit is contained in:
commit
b11ef87d42
4
doc.go
4
doc.go
|
@ -127,10 +127,10 @@ Attention: the above 7 methods should be the last chainable method.
|
||||||
// SELECT TOP 5 * FROM user // for mssql
|
// SELECT TOP 5 * FROM user // for mssql
|
||||||
// SELECT * FROM user LIMIT .. OFFSET 0 //for other databases
|
// SELECT * FROM user LIMIT .. OFFSET 0 //for other databases
|
||||||
|
|
||||||
5. Sql, let you custom SQL
|
5. SQL, let you custom SQL
|
||||||
|
|
||||||
var users []User
|
var users []User
|
||||||
engine.Sql("select * from user").Find(&users)
|
engine.SQL("select * from user").Find(&users)
|
||||||
|
|
||||||
6. Cols, Omit, Distinct
|
6. Cols, Omit, Distinct
|
||||||
|
|
||||||
|
|
|
@ -295,11 +295,6 @@ func (engine *Engine) logSQLExecutionTime(sqlStr string, args []interface{}, exe
|
||||||
return executionBlock()
|
return executionBlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sql will be depracated, please use SQL instead
|
|
||||||
func (engine *Engine) Sql(querystring string, args ...interface{}) *Session {
|
|
||||||
return engine.SQL(querystring, args...)
|
|
||||||
}
|
|
||||||
|
|
||||||
// SQL method let's you manualy write raw SQL and operate
|
// SQL method let's you manualy write raw SQL and operate
|
||||||
// For example:
|
// For example:
|
||||||
//
|
//
|
||||||
|
|
|
@ -56,7 +56,7 @@ func main() {
|
||||||
fmt.Println(info)
|
fmt.Println(info)
|
||||||
|
|
||||||
infos := make([]LoginInfo1, 0)
|
infos := make([]LoginInfo1, 0)
|
||||||
err = Orm.Sql(`select *, (select name from user where id = login_info.user_id) as user_name from
|
err = Orm.SQL(`select *, (select name from user where id = login_info.user_id) as user_name from
|
||||||
login_info limit 10`).Find(&infos)
|
login_info limit 10`).Find(&infos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
|
Loading…
Reference in New Issue