File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -192,18 +192,26 @@ SELECT * FROM TABLE_NAME WHERE name = ?
1921922 . 当参数的func返回非nil的错误,则回滚
1931933 . 当参数的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
197205gobatis支持xml的sql解析及动态sql
198206
199- 1 . 注册xml
207+ 1 . 直接注册xml
200208
201209```
202210gobatis.RegisterMapperData([]byte(main_xml))
203211```
204212
205213或
206-
214+
207215```
208216gobatis.RegisterMapperFile(filePath)
209217```
@@ -282,11 +290,11 @@ xml数据或文件注册之后,session参数sqlid与xml action对应关系为
282290sess.Select("test.selectTestTable").Param(model).Result(&dataList)
283291```
284292
285- ### 8 、template
293+ ### 9 、template
286294
287295gobatis也支持go template的sql解析及动态sql
288296
289- 1 . 注册template
297+ 1 . 直接注册template
290298
291299```
292300gobatis.RegisterTemplateData([]byte(main_xml))
@@ -349,11 +357,11 @@ template数据或文件注册之后,session参数sql id与模板对应关系
349357sess.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
358366gobatis xml特性有非常强大的动态SQL生成方案,当需要在代码中嵌入SQL语句时,也可使用SQL语句构建器:
359367```
You can’t perform that action at this time.
0 commit comments