Commit 18c09bb2 authored by slene's avatar slene

orm update docs

parent 45345fa7
......@@ -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
三种数据库类型
......
## 使用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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment