-
Notifications
You must be signed in to change notification settings - Fork 283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use undo config #419
use undo config #419
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ package at | |
import ( | ||
"context" | ||
"database/sql/driver" | ||
"github.com/seata/seata-go/pkg/datasource/sql/undo" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. format There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 好了 |
||
"reflect" | ||
"testing" | ||
|
||
|
@@ -39,6 +40,7 @@ import ( | |
) | ||
|
||
func TestBuildSelectSQLByUpdate(t *testing.T) { | ||
undo.InitUndoConfig(undo.Config{OnlyCareUpdateColumns: true}) | ||
datasource.RegisterTableCache(types.DBTypeMySQL, mysql.NewTableMetaInstance(nil)) | ||
stub := gomonkey.ApplyMethod(reflect.TypeOf(datasource.GetTableCache(types.DBTypeMySQL)), "GetTableMeta", | ||
func(_ *mysql.TableMetaCache, ctx context.Context, dbName, tableName string) (*types.TableMeta, error) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,14 @@ import ( | |
"flag" | ||
) | ||
|
||
var ( | ||
UndoConfig Config | ||
) | ||
|
||
func InitUndoConfig(cfg Config) { | ||
UndoConfig = cfg | ||
} | ||
|
||
type CompressConfig struct { | ||
Comment on lines
+24
to
32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里没看懂,为啥是这么写的 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 因为这个undo config在多个地方用了,所以搞了一个全局变量来使用。感觉是不太好 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 一下没想好放哪里比较合适。后面重构,可以把这个放到具体的struct的初始化里面去,会更好点 |
||
Enable bool `yaml:"enable" json:"enable,omitempty" koanf:"enable"` | ||
Type string `yaml:"type" json:"type,omitempty" koanf:"type"` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里需要增加async的配置
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加好了