Skip to content

Commit

Permalink
Merge pull request #16 from streetbyters/development
Browse files Browse the repository at this point in the history
Add: new config methods
  • Loading branch information
sadihakan committed Apr 1, 2021
2 parents 482aa5f + c3b8339 commit 4441714
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions dummy_dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ type DummyDump struct {
}

// New ..
func New(config *config.Config) (*DummyDump, error) {
func New(cfg ...*config.Config) (*DummyDump, error) {
dd := new(DummyDump)
dd.c = config

if len(cfg) > 0 {
dd.c = cfg[0]
} else {
dd.c = new(config.Config)
}

if err := dd.configParser(); err != nil {
return nil, err
Expand All @@ -26,6 +31,17 @@ func New(config *config.Config) (*DummyDump, error) {
return dd, nil
}

// SetUser ..
func (dd *DummyDump) SetUser(username, password string) {
dd.c.User = username
dd.c.Password = password
}

// SetBinaryPath ..
func (dd *DummyDump) SetBinaryPath(binaryPath string) {
dd.c.BinaryPath = binaryPath
}

func (dd *DummyDump) configParser() (err error) {
switch dd.c.Source {
case config.PostgreSQL:
Expand Down

0 comments on commit 4441714

Please sign in to comment.