@@ -0,0 +1,27 @@
|
||||
package db
|
||||
|
||||
// 事务设置
|
||||
type TransOpts struct {
|
||||
ReEntryCount *int //重入次数
|
||||
//...
|
||||
}
|
||||
|
||||
func (t *TransOpts) SetReEntry(count int) *TransOpts {
|
||||
t.ReEntryCount = &count
|
||||
return t
|
||||
}
|
||||
|
||||
// MergeTransOpts 合并事务设置
|
||||
func MergeTransOpts(opts []*TransOpts) *TransOpts {
|
||||
transOpts := &TransOpts{}
|
||||
for _, opt := range opts {
|
||||
if opt == nil {
|
||||
continue
|
||||
}
|
||||
if opt.ReEntryCount != nil {
|
||||
transOpts.ReEntryCount = opt.ReEntryCount
|
||||
//...
|
||||
}
|
||||
}
|
||||
return transOpts
|
||||
}
|
||||
Reference in New Issue
Block a user