This commit is contained in:
Yoshiki Nakagawa 2016-12-10 10:02:27 +00:00 committed by GitHub
commit b11ef87d42
3 changed files with 3 additions and 8 deletions

4
doc.go
View File

@ -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

View File

@ -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:
// //

View File

@ -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)