diff --git a/common/db.go b/common/db.go index 27a07dc..a9c315d 100644 --- a/common/db.go +++ b/common/db.go @@ -44,12 +44,6 @@ func (m *DB) Must() *DB { return &DB{DB: db} } -// NoMust unset must flag, don't panic when error occur -func (m *DB) NoMust() *DB { - db := m.InstanceSet("ivy.must", false) - return &DB{DB: db} -} - // ToSQLDB get the sql.DB func (m *DB) ToSQLDB() *sql.DB { d, err := m.DB.DB() diff --git a/common/types.go b/common/types.go index f95daf7..7577db0 100644 --- a/common/types.go +++ b/common/types.go @@ -13,10 +13,6 @@ import ( "github.com/go-redis/redis/v8" ) -func GetDriver() string { - return Config.Store.Driver -} - var rdb *redis.Client var once sync.Once diff --git a/common/types_test.go b/common/types_test.go index 7890c6c..8aea076 100644 --- a/common/types_test.go +++ b/common/types_test.go @@ -24,8 +24,6 @@ func testSql(t *testing.T) { db := DbGet(Config.Store.GetDBConf()) err := func() (rerr error) { defer dtmimp.P2E(&rerr) - dbr := db.NoMust().Exec("select a") - assert.NotEqual(t, nil, dbr.Error) db.Must().Exec("select a") return nil }() diff --git a/conf.sample.yml b/conf.sample.yml index 79a9fe2..c6b12ba 100644 --- a/conf.sample.yml +++ b/conf.sample.yml @@ -1,33 +1,41 @@ -# Store: +# Store: # specify which engine to store trans status +# Driver: 'boltdb' # default store engine + # Driver: 'redis' # Host: 'localhost' # User: '' # Password: '' # Port: 6379 -# driver: 'postgres' -# host: 'localhost' -# user: 'postgres' -# password: 'mysecretpassword' -# port: '5432' +# Driver: 'mysql' +# Host: 'localhost' +# User: 'root' +# Password: '' +# Port: 3306 + +# Driver: 'postgres' +# Host: 'localhost' +# User: 'postgres' +# Password: 'mysecretpassword' +# Port: '5432' + +### following connection config is for only Driver postgres/mysql +# MaxOpenConns: 500 +# MaxIdleConns: 500 +# ConnMaxLifeTime 5 # default value is 5 (minutes) -# MaxOpenConns: 499 -# max_idle_conns: 'dbmaxidleconns' -# conn_max_life_time: 'dbconnmaxlifetime' # MicroService: # Driver: 'dtm-driver-gozero' # name of the driver to handle register/discover # Target: 'etcd://localhost:2379/dtmservice' # register dtm server to this url # EndPoint: 'localhost:36790' -# MicroService: -# Driver: 'dtm-driver-protocol1' - # the unit of following configurations is second # TransCronInterval: 3 # the interval to poll unfinished global transaction for every dtm process # TimeoutToFail: 35 # timeout for XA, TCC to fail. saga's timeout default to infinite, which can be overwritten in saga options # RetryInterval: 10 # the subtrans branch will be retried after this interval +### db config of examples ExamplesDB: Driver: 'mysql' Host: 'localhost'