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

Consider Adding Type Alias for tftypes.Transform Functions #108

Closed
bflad opened this issue Sep 21, 2021 · 2 comments
Closed

Consider Adding Type Alias for tftypes.Transform Functions #108

bflad opened this issue Sep 21, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@bflad
Copy link
Contributor

bflad commented Sep 21, 2021

terraform-plugin-go version

v0.3.1

Use cases

Large downstream implementations of tftypes transformations tend to be wrapped into helper functions.

Attempted solutions

Declaring helper functions with whole function in returns, e.g.

func (s State) setAttributeTransformFunc(ctx context.Context, path *tftypes.AttributePath, tfVal tftypes.Value, diags diag.Diagnostics) (func(*tftypes.AttributePath, tftypes.Value) (tftypes.Value, error), diag.Diagnostics) {

Proposal

It would be great to have a type alias to simplify these declarations, e.g.

type TransformFunc func(*AttributePath, Value) (Value, error)

So implementations can then be:

func (s State) setAttributeTransformFunc(ctx context.Context, path *tftypes.AttributePath, tfVal tftypes.Value, diags diag.Diagnostics) (tftypes.TransformFunc, diag.Diagnostics) {

References

@bflad bflad added the enhancement New feature or request label Sep 21, 2021
@bflad
Copy link
Contributor Author

bflad commented Jul 1, 2022

Closing along the similar lines of #5

@bflad bflad closed this as completed Jul 1, 2022
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant