mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 03:40:54 +00:00
orm update docs
This commit is contained in:
parent
45345fa782
commit
18c09bb2ed
@ -4,9 +4,13 @@ a powerful orm framework
|
||||
|
||||
now, beta, unstable, may be changing some api make your app build failed.
|
||||
|
||||
**Driver Support:**
|
||||
**Support Database:**
|
||||
|
||||
* MySQL: [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql)
|
||||
* PostgreSQL: [github.com/lib/pq](https://github.com/lib/pq)
|
||||
* Sqlite3: [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)
|
||||
|
||||
Passed all test, but need more feedback.
|
||||
|
||||
**Features:**
|
||||
|
||||
@ -139,7 +143,5 @@ more details and examples in docs and test
|
||||
- some unrealized api
|
||||
- examples
|
||||
- docs
|
||||
- support sqlite
|
||||
- support postgres
|
||||
|
||||
##
|
||||
|
@ -66,6 +66,18 @@ func main() {
|
||||
|
||||
## 数据库的设置
|
||||
|
||||
目前 orm 支持三种数据库,以下为测试过的 driver
|
||||
|
||||
将你需要使用的 driver 加入 import 中
|
||||
|
||||
```go
|
||||
import (
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/lib/pq"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
```
|
||||
|
||||
#### RegisterDriver
|
||||
|
||||
三种数据库类型
|
||||
|
@ -1,6 +1,13 @@
|
||||
## 使用SQL语句进行查询
|
||||
|
||||
使用 Raw SQL 查询,无需使用 ORM 表定义
|
||||
* 使用 Raw SQL 查询,无需使用 ORM 表定义
|
||||
* 多数据库,都可直接使用占位符号 `?`,自动转换
|
||||
* 查询时的参数,支持使用 Model Struct 和 Slice, Array
|
||||
|
||||
```go
|
||||
ids := []int{1, 2, 3}
|
||||
p.Raw("SELECT name FROM user WHERE id IN (?, ?, ?)", ids)
|
||||
```
|
||||
|
||||
创建一个 **RawSeter**
|
||||
|
||||
@ -44,8 +51,9 @@ TODO
|
||||
用于单条 sql 语句,重复利用,替换参数然后执行。
|
||||
|
||||
```go
|
||||
num, err := r.SetArgs("set name", "name1").Exec()
|
||||
num, err := r.SetArgs("set name", "name2").Exec()
|
||||
num, err := r.SetArgs("arg1", "arg2").Exec()
|
||||
num, err := r.SetArgs("arg1", "arg2").Exec()
|
||||
...
|
||||
```
|
||||
#### Values / ValuesList / ValuesFlat
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user