-
Notifications
You must be signed in to change notification settings - Fork 51
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
Map backend #12 - added a map to store default in backend #52
Conversation
backend/backend.go
Outdated
@@ -21,9 +21,15 @@ func Func(name string, fn func(context.Context, string) ([]byte, error)) Backend | |||
return &backendFunc{fn: fn, name: name} | |||
} | |||
|
|||
// Func creates a Backend from a function and allows users to add a defai;t map. |
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.
Looks like a typo in the comment
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.
ty for the catch, submitting something to fix it =)
@alsutton If this looks okay should we merge it? |
Sorry for the delay guys, this one will be reviewed as soon as possible. Thank you for your understanding. |
All good! Ty for the response |
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.
Thanks for the suggestion, but I think the map backend as proposed in #36 will fulfil this functionality, as it can be used as a fallback to provide defaults, so I'm going to close this PR as redundant.
@@ -21,9 +21,15 @@ func Func(name string, fn func(context.Context, string) ([]byte, error)) Backend | |||
return &backendFunc{fn: fn, name: name} | |||
} | |||
|
|||
// FuncWithDefaults creates a Backend from a function and allows users to add a default map. | |||
func FuncWithDefaults(name string, defaults map[string]string, fn func(context.Context, string) ([]byte, error)) Backend { |
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.
I don't understand what this is doing. The defaults value here is never used.
In this pull request, we are adding a map of defaults for usage by the different backends. Based on the ticket, I believe this is what is required, however I do apologize if I misunderstood it
I also wasn't sure if a the type
map[string][string]
is the best solution. I was thinking of using amap[string]interface{}
, but wasn't sure if the user would want to define an object as a valueIssue # 12