Skip to content

Commit

Permalink
Merge pull request #25 from go-zoox/fix/debug-marshal-config-error
Browse files Browse the repository at this point in the history
fix: debug marshal config error because func cannot be marshal, shoul…
  • Loading branch information
whatwewant committed Dec 17, 2023
2 parents 0c46866 + f076b54 commit 829b0d2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Config struct {
//
Context context.Context
//
OnProgress func(percent int64, current, total int64)
OnProgress OnProgress
//
BasicAuth BasicAuth
//
Expand All @@ -61,6 +61,19 @@ type BasicAuth struct {
Password string
}

// OnProgress is the progress callback
type OnProgress func(percent int64, current, total int64)

// MarshalJSON returns the json string
func (op *OnProgress) MarshalJSON() ([]byte, error) {
return []byte("null"), nil
}

// UnmarshalJSON unmarshals the json string
func (op *OnProgress) UnmarshalJSON(data []byte) error {
return nil
}

// Merge merges the config with the given config
func (c *Config) Merge(config *Config) {
if config == nil {
Expand Down

0 comments on commit 829b0d2

Please sign in to comment.