Skip to content

Commit

Permalink
added option to registry
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed May 18, 2023
1 parent a6a7525 commit c1c8218
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Registry struct {
differs map[reflect.Type]map[reflect.Type]*Differ
}

func (r *Registry) Get(from, to reflect.Type, tag *Tag) (*Differ, error) {
func (r *Registry) Get(from, to reflect.Type, tag *Tag, options ...Option) (*Differ, error) {
if tag != nil && (tag.PairSeparator != "" || tag.ItemSeparator != "") {
return New(from, to, WithRegistry(r), WithTag(tag))
}
Expand All @@ -23,7 +23,8 @@ func (r *Registry) Get(from, to reflect.Type, tag *Tag) (*Differ, error) {
return differ, nil
}
var err error
if differ, err = New(from, to, WithRegistry(r), WithTag(tag)); err != nil {
options = append(options, WithRegistry(r), WithTag(tag))
if differ, err = New(from, to, options...); err != nil {
return nil, err
}
r.RWMutex.Lock()
Expand Down

0 comments on commit c1c8218

Please sign in to comment.