Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
18c09bb2
authored
2013-08-11 22:27:54 +0800
by
slene
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
orm update docs
1 parent
45345fa7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
6 deletions
orm/README.md
orm/docs/zh/Orm.md
orm/docs/zh/Raw.md
orm/README.md
View file @
18c09bb
...
...
@@ -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 @
18c09bb
...
...
@@ -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 @
18c09bb
## 使用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
Styling with
Markdown
is supported
Attach a file
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 post a comment