Skip to content

Commit 64eda8a

Browse files
committed
update README.md
1 parent 4a59f26 commit 64eda8a

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,26 @@ SELECT * FROM TABLE_NAME WHERE name = ?
192192
2. 当参数的func返回非nil的错误,则回滚
193193
3. 当参数的func内抛出panic,则回滚
194194

195-
### 7、xml
195+
### 7、扫描mapper文件
196+
```
197+
err := gobatis.ScanMapperFile(${MAPPER_FILE_DIR})
198+
if err != nil {
199+
t.Fatal(err)
200+
}
201+
```
202+
203+
### 8、xml
196204

197205
gobatis支持xml的sql解析及动态sql
198206

199-
1. 注册xml
207+
1. 直接注册xml
200208

201209
```
202210
gobatis.RegisterMapperData([]byte(main_xml))
203211
```
204212

205213
206-
214+
207215
```
208216
gobatis.RegisterMapperFile(filePath)
209217
```
@@ -282,11 +290,11 @@ xml数据或文件注册之后,session参数sqlid与xml action对应关系为
282290
sess.Select("test.selectTestTable").Param(model).Result(&dataList)
283291
```
284292

285-
### 8、template
293+
### 9、template
286294

287295
gobatis也支持go template的sql解析及动态sql
288296

289-
1. 注册template
297+
1. 直接注册template
290298

291299
```
292300
gobatis.RegisterTemplateData([]byte(main_xml))
@@ -349,11 +357,11 @@ template数据或文件注册之后,session参数sql id与模板对应关系
349357
sess.Select("test.selectTestTable").Param(model).Result(&dataList)
350358
```
351359

352-
### 9、gobatis-cmd生成文件使用示例
360+
### 10、gobatis-cmd生成文件使用示例
353361

354362
参考[cmd_test](https://github.com/xfali/gobatis/tree/master/test/cmd)
355363

356-
### 10、 SQL语句构建器
364+
### 11、 SQL语句构建器
357365

358366
gobatis xml特性有非常强大的动态SQL生成方案,当需要在代码中嵌入SQL语句时,也可使用SQL语句构建器:
359367
```

0 commit comments

Comments
 (0)