28 lines
479 B
Go
28 lines
479 B
Go
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
|
|
}
|