-
Notifications
You must be signed in to change notification settings - Fork 464
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
[4/6] filterx: implement merging of two iterable objects #4866
Closed
alltilla
wants to merge
13
commits into
syslog-ng:master
from
alltilla:filterx-merge-operator-with-other-object
Closed
[4/6] filterx: implement merging of two iterable objects #4866
alltilla
wants to merge
13
commits into
syslog-ng:master
from
alltilla:filterx-merge-operator-with-other-object
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alltilla
changed the title
filterx: implement merging of two iterable objects
[4/5] filterx: implement merging of two iterable objects
Mar 21, 2024
alltilla
force-pushed
the
filterx-merge-operator-with-other-object
branch
2 times, most recently
from
March 25, 2024 08:39
ff8c963
to
1e31c86
Compare
Build FAILURE |
@kira-syslogng retest this please |
alltilla
changed the title
[4/5] filterx: implement merging of two iterable objects
[4/6] filterx: implement merging of two iterable objects
Mar 25, 2024
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
They will be useful later for the generator logic. Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
We don't have generic dicts or lists in filterx. We have dict and a list interface, which can be implemented by anyone. Literal dicts and lists do not make sense in this case, however with a bit of trickery we can make them "generator"s, which use the dict and list interfaces and operate on an actual implementation. For this we introduce the merge "<<" operator, which on the left hand side expects an object that is a dict or list implementation, and a "generator" on the right hand side (in the form of literal dict and list for now, but functions will be added soon). The merge operator passes the "fillable" to the generator, which then fills it appropriatery. Please note that this is a shallow merge: * lists are always appended * dict merging works like python's dict update() function Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
We should be able to create a json_array like these: $arr = $json_array(); $arr = $json_array("[\"foo\", \"bar\"]"); $arr = $json("[\"foo\", \"bar\"]"); Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
E.g.: $js = json_array(); $js << [1, 2, 3]; $otel_arr = otel_array(); $otel_arr << [4, 5, 6]; $js << $otel_arr; $js_obj = json(); $js_obj << {"foo": 1}; $otel_kvl = otel_kvlist(); $otel_kvl << {"bar": 2}; $js_obj << $otel_kvl; Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
Signed-off-by: Attila Szakacs <attila.szakacs@axoflow.com>
alltilla
force-pushed
the
filterx-merge-operator-with-other-object
branch
from
March 26, 2024 08:03
1e31c86
to
edbf47d
Compare
bshifter
approved these changes
Mar 27, 2024
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.
lgtm
Closing, as this will be implemented in a completely different way. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
E.g.:
Depends on #4860, #4861 and #4862