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

GetBackend with functional params instead of GetBackendWithParams #18

Merged
merged 1 commit into from
Nov 11, 2022

Conversation

wojas
Copy link
Member

@wojas wojas commented Nov 2, 2022

Instead of deprecating GetBackend in favor of a new GetBackendWithParams, extend the GetBackend signature with variadic functional params. This way existing code can simply keep calling the same function, and we have even more flexibility in the options we provide in the future.

This drops the GetBackendWithParams that was added in PR #17.

Example usage:

	storage, err := simpleblob.GetBackend(
		ctx,
		"memory",
		map[string]any{
			// add key-value options here
			"foo": "example",
		},
		simpleblob.WithLogger(logr.Discard()), // replace with a real logger
	)

Instead of deprecating GetBackend in favor of a new
GetBackendWithParams, extend the GetBackend signature with variadic
functional params. This way existing code can simply keep calling the
same function, and we have even more flexibility in the options
we provide in the future.
@wojas wojas requested a review from ahouene November 2, 2022 08:03
Copy link
Contributor

@ahouene ahouene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good idea, just one concern I have commented in plugins.go :)

plugins.go Show resolved Hide resolved
@wojas wojas merged commit 3704775 into main Nov 11, 2022
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.

2 participants