Skip to content

Commit

Permalink
edit doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Dec 29, 2020
1 parent 68caaa7 commit 5fe13a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README-ch.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ type ExampleActivityMapper struct {
## 功能:动态数据源
``` go
//添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接
GoMybatis.Open("mysql", MysqlUri)
//动态数据源路由
var engine = GoMybatis.GoMybatisEngine{}.New()
engine.Open("mysql", MysqlUri)//添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接
var router = GoMybatis.GoMybatisDataSourceRouter{}.New(func(mapperName string) *string {
//根据包名路由指向数据源
if strings.Contains(mapperName, "example.") {
Expand All @@ -195,6 +195,7 @@ type ExampleActivityMapper struct {
}
return nil
})
engine.SetDataSourceRouter(&router)
```
## 功能:自定义日志输出
``` go
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,18 @@ type ExampleActivityMapper struct {
## Features:Dynamic Data Source
``` go
//To add a second MySQL database, change Mysql Uri to your second data source link
GoMybatis.Open("mysql", MysqlUri)
//Dynamic Data Source Routing
var engine = GoMybatis.GoMybatisEngine{}.New()
engine.Open("mysql", MysqlUri)//添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接
var router = GoMybatis.GoMybatisDataSourceRouter{}.New(func(mapperName string) *string {
//Point to the data source according to the packet name routing
//根据包名路由指向数据源
if strings.Contains(mapperName, "example.") {
var url = MysqlUri//The second MySQL database, please change Mysql Uri to your second data source link
var url = MysqlUri//第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接
fmt.Println(url)
return &url
}
return nil
})
engine.SetDataSourceRouter(&router)
```
## Features:Custom log output
``` go
Expand Down
2 changes: 1 addition & 1 deletion example/Example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func init() {

//动态数据源路由(可选)
/**
GoMybatis.Open("mysql", MysqlUri)//添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接
engine.Open("mysql", MysqlUri)//添加第二个mysql数据库,请把MysqlUri改成你的第二个数据源链接
var router = GoMybatis.GoMybatisDataSourceRouter{}.New(func(mapperName string) *string {
//根据包名路由指向数据源
if strings.Contains(mapperName, "example.") {
Expand Down

0 comments on commit 5fe13a8

Please sign in to comment.