Skip to content

Commit

Permalink
Merge pull request #118 from certego/develop
Browse files Browse the repository at this point in the history
0.13.0
  • Loading branch information
0ssigeno authored Aug 29, 2023
2 parents 60cbaca + d5e25e5 commit 7613ff4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/_release_and_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ jobs:
run: |
python -m build --sdist --wheel --outdir dist/
- name: Checkout created tag
uses: actions/checkout@v3
if: steps.check-tag.outputs.match == 'true' && ( inputs.publish_on_test_pypi || inputs.publish_on_pypi)

- name: Publish to test PyPi
uses: pypa/gh-action-pypi-publish@release/v1
if: inputs.publish_on_test_pypi
Expand Down
15 changes: 15 additions & 0 deletions atlasq/queryset/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class AtlasTransform:
"iregex",
"match",
"is",
"type",
]
type_keywords = ["type"]
negative_keywords = ["ne", "nin", "not"]
exists_keywords = ["exists"]
range_keywords = ["gt", "gte", "lt", "lte"]
Expand Down Expand Up @@ -74,6 +76,15 @@ def __init__(self, atlas_query, atlas_index: AtlasIndex):
self.atlas_query = atlas_query
self.atlas_index = atlas_index

def _type(self, path: str, value: str):
return {
"$match": {
path: {
"$type": value,
}
}
}

def _all(self, path: str, values: List[str]):
filters = []
for value in values:
Expand Down Expand Up @@ -273,6 +284,10 @@ def transform(self) -> Tuple[List[Dict], List[Dict], List[Dict]]:
if keyword in self.all_keywords:
obj = self._all(path, value)
break
if keyword in self.type_keywords:
if to_go == -1:
raise NotImplementedError(f"At the moment you can't have a negative `{keyword}` keyword")
other_aggregations.append(self._type(path, value))
else:
if not path:
path = ".".join(key_parts)
Expand Down

0 comments on commit 7613ff4

Please sign in to comment.