Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Map backend #12 - added a map to store default in backend #52

wants to merge 4 commits into from

Conversation

zelahi
Copy link

@zelahi zelahi commented Jan 10, 2019

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 a map[string]interface{}, but wasn't sure if the user would want to define an object as a value

Issue # 12

@@ -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.
Copy link

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

Copy link
Author

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 =)

@zelahi
Copy link
Author

zelahi commented Jul 29, 2019

@alsutton If this looks okay should we merge it?

@yaziine yaziine self-requested a review July 29, 2019 17:04
@yaziine
Copy link

yaziine commented Jul 29, 2019

Sorry for the delay guys, this one will be reviewed as soon as possible. Thank you for your understanding.

@zelahi
Copy link
Author

zelahi commented Jul 29, 2019

All good! Ty for the response

Copy link
Contributor

@rogpeppe rogpeppe left a 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 {
Copy link
Contributor

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.

@rogpeppe rogpeppe closed this Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants