Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lichunzhu authored and ti-chi-bot committed Jul 15, 2021
1 parent f1e35da commit 972a640
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
7 changes: 0 additions & 7 deletions v4/export/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,6 @@ func DefaultConfig() *Config {
}
}

// Clone clones a dumpling config.
func (conf *Config) Clone() *Config {
clone := &Config{}
*clone = *conf
return clone
}

// String returns dumpling's config in json format
func (conf *Config) String() string {
cfg, err := json.Marshal(conf)
Expand Down
11 changes: 9 additions & 2 deletions v4/export/writer_util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,22 @@ func (s *testWriteSuite) TestWrite(c *C) {
c.Assert(err, IsNil)
}

// cloneConfigForTest clones a dumpling config.
func cloneConfigForTest(conf *Config) *Config {
clone := &Config{}
*clone = *conf
return clone
}

func configForWriteSQL(config *Config, fileSize, statementSize uint64) *Config {
cfg := config.Clone()
cfg := cloneConfigForTest(config)
cfg.FileSize = fileSize
cfg.StatementSize = statementSize
return cfg
}

func configForWriteCSV(config *Config, noHeader bool, opt *csvOption) *Config {
cfg := config.Clone()
cfg := cloneConfigForTest(config)
cfg.NoHeader = noHeader
cfg.CsvNullValue = opt.nullValue
cfg.CsvDelimiter = string(opt.delimiter)
Expand Down

0 comments on commit 972a640

Please sign in to comment.