Skip to content

Commit

Permalink
删除远程事务功能.后期采用其他的实现方式
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuxiujia committed Apr 13, 2019
1 parent 20919f0 commit 1b9c7f2
Show file tree
Hide file tree
Showing 18 changed files with 7 additions and 876 deletions.
10 changes: 3 additions & 7 deletions GoMybatis.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ func WriteMapper(bean reflect.Value, xml []byte, sessionFactory *SessionFactory,
}
var session Session
var err error
if len(args) == 1 && args[0].IsValid() == true && !args[0].IsNil() {
session = sessionFactory.NewSession(beanName, SessionType_TransationRM, args[0].Interface().(*TransationRMClientConfig))
} else {
session = sessionFactory.NewSession(beanName, SessionType_Default, nil)
}
if session != nil {
returnValue.Elem().Set(reflect.ValueOf(session).Elem().Addr().Convert(*returnType.ReturnOutType))
} else {
err = utils.NewError("GoMybatis", "Create Session fail.")
//err = utils.NewError("GoMybatis", "Create Session fail.arg session not exist!")
session = sessionFactory.NewSession(beanName, SessionType_Default)
}
return buildReturnValues(returnType, returnValue, err)
}
Expand Down Expand Up @@ -331,7 +327,7 @@ func exeMethodByXml(elementType ElementType, beanName string, sessionFactory *Se
}
//session
if session == nil {
session = sessionFactory.NewSession(beanName, SessionType_Default, nil)
session = sessionFactory.NewSession(beanName, SessionType_Default)
//not arg session,just close!
defer closeSession(sessionFactory, session)
}
Expand Down
1 change: 1 addition & 0 deletions GoMybatisEngine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"
"testing"
"time"
_ "github.com/go-sql-driver/mysql"
)

//假设Mysql 数据库查询时间为0,框架单协程的Benchmark性能
Expand Down
3 changes: 0 additions & 3 deletions README-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
<a href="https://zhuxiujia.github.io/gomybatis.io/info.html">-Template element</a>High development efficiency template, one line of code to achieve additions, deletions, modifications, logical deletions, optimistic lock version number<br>
#### Asynchronous Message Queue Logging System
![Image text](https://zhuxiujia.github.io/gomybatis.io/assets/log_system.png)
#### Over-remote substitution for micro-service members to handle transactions supports micro-services during the transition from single database (Mysql, postgresql) to distributed database (TiDB, cockroachdb...)
![Image text](https://zhuxiujia.github.io/gomybatis.io/assets/tx.png)

Database Driven List
```
Mysql: github.com/go-sql-driver/mysql
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

#### 异步消息队列日志系统
![Image text](https://zhuxiujia.github.io/gomybatis.io/assets/log_system.png)
#### 通过远程代替微服务成员 处理事务支持 处于 单数据库(Mysql,postgresql)-分布式数据库(TiDB,cockroachdb...)过渡期间的微服务
![Image text](https://zhuxiujia.github.io/gomybatis.io/assets/tx.png)

数据库驱动列表
```
Mysql: github.com/go-sql-driver/mysql
Expand Down
12 changes: 1 addition & 11 deletions SessionFactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func (it SessionFactory) New(Engine SessionEngine) SessionFactory {
return it
}

func (it *SessionFactory) NewSession(mapperName string, sessionType SessionType, config *TransationRMClientConfig) Session {
func (it *SessionFactory) NewSession(mapperName string, sessionType SessionType) Session {
if it.SessionMap == nil || it.Engine == nil {
panic("[GoMybatis] SessionFactory not init! you must call method SessionFactory.New(*)")
}
Expand All @@ -35,16 +35,6 @@ func (it *SessionFactory) NewSession(mapperName string, sessionType SessionType,
panic(err)
}
break
case SessionType_TransationRM:
if config == nil {
panic("[GoMybatis] SessionFactory can not create TransationRMSession,config *TransationRMClientConfig is nil!")
}
var transationRMSession = TransationRMSession{}.New(mapperName, config.TransactionId, &TransationRMClient{
RetryTime: config.RetryTime,
Addr: config.Addr,
}, config.Status)
newSession = Session(*transationRMSession)
break
default:
panic("[GoMybatis] newSession() must have a SessionType!")
}
Expand Down
1 change: 0 additions & 1 deletion SessionType.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ type SessionType = int
const (
SessionType_Default SessionType = iota //默认session类型
SessionType_Local //本地session
SessionType_TransationRM //远程session
)
42 changes: 0 additions & 42 deletions TransactionDefinition.go

This file was deleted.

49 changes: 0 additions & 49 deletions TransactionFactory.go

This file was deleted.

1 change: 0 additions & 1 deletion TransactionFactory_test.go

This file was deleted.

Loading

0 comments on commit 1b9c7f2

Please sign in to comment.