Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
18c09bb2
Commit
18c09bb2
authored
Aug 11, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orm update docs
parent
45345fa7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
+28
-6
README.md
orm/README.md
+5
-3
Orm.md
orm/docs/zh/Orm.md
+12
-0
Raw.md
orm/docs/zh/Raw.md
+11
-3
No files found.
orm/README.md
View file @
18c09bb2
...
...
@@ -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
##
orm/docs/zh/Orm.md
View file @
18c09bb2
...
...
@@ -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
三种数据库类型
...
...
orm/docs/zh/Raw.md
View file @
18c09bb2
## 使用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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment