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

feat(stdlib): Add new object_from_array function #1164

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

bruceg
Copy link
Member

@bruceg bruceg commented Dec 3, 2024

Summary

Adds a new object_from_array function as discussed in #1157

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Unit tests are included

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on
    our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.

Checklist

  • Our CONTRIBUTING.md is a good starting place.
  • If this PR introduces changes to LICENSE-3rdparty.csv, please
    run dd-rust-license-tool write and commit the changes. More details here.
  • For new VRL functions, please also create a sibling PR in Vector to document the new function.

@bruceg bruceg added vrl: stdlib Changes to the standard library type: feature A value-adding code addition that introduce new functionality. labels Dec 3, 2024
@bruceg bruceg requested a review from pront December 3, 2024 20:41
@bruceg bruceg force-pushed the bruceg/object-from-array branch from 560c945 to 7bdd2c9 Compare December 3, 2024 20:41
@bruceg
Copy link
Member Author

bruceg commented Dec 3, 2024

Note that I plan a follow-up PR to add support for an optional keys parameter to avoid the need for zip and to add support for null keys. If you think that doing an implicit to_string on every key is reasonable, I would be open to that too, but that might be a little surprising.

Also, I don't really like the name object_from_array and would love a better suggestion. If you think from_array actually makes more sense, I can do that too.

}

#[derive(Clone, Debug)]
enum ConstOrExpr {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a straight-up clone of the construct in zip. Where would it make sense to move it into common code?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we can introduce a src/stdlib/utils.rs (for the lack of a better name)

Copy link
Member

@pront pront left a comment

Choose a reason for hiding this comment

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

Thanks!

@bruceg bruceg added this pull request to the merge queue Dec 4, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2024
@bruceg bruceg enabled auto-merge December 4, 2024 19:52
@bruceg bruceg added this pull request to the merge queue Dec 4, 2024
Merged via the queue into main with commit 6709de7 Dec 4, 2024
15 checks passed
@bruceg bruceg deleted the bruceg/object-from-array branch December 4, 2024 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A value-adding code addition that introduce new functionality. vrl: stdlib Changes to the standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants