Skip to content

Commit 5af4a03

Browse files
committed
update tools
1 parent 4a27897 commit 5af4a03

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

build/lib/sbxpy/QueryBuilder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self):
1212
"GROUP": []
1313
}
1414
self.OP = ["in", "IN", "not in", "NOT IN", "is", "IS", "is not", "IS NOT", "<>", "!=", "=", "<", "<=", ">=", ">",
15-
"like", "LIKE"]
15+
"like", "LIKE", "not like", "NOT LIKE"]
1616

1717
def set_domain(self, domain_id):
1818
self.q['domain'] = domain_id

build/lib/sbxpy/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ def and_where_contains(self, field, value):
9292
self.query.add_condition(self.lastANDOR, field, 'LIKE', '%' + value + '%')
9393
return self
9494

95+
def and_where_not_contains(self, field, value):
96+
self.lastANDOR = 'AND'
97+
self.query.add_condition(self.lastANDOR, field, 'NOT LIKE', '%' + value + '%')
98+
return self
99+
95100
def and_where_in(self, field, value):
96101
self.lastANDOR = 'AND'
97102
self.query.add_condition(self.lastANDOR, field, 'IN', value)
@@ -157,6 +162,11 @@ def or_where_contains(self, field, value):
157162
self.query.add_condition(self.lastANDOR, field, 'LIKE', '%' + value + '%')
158163
return self
159164

165+
def or_where_not_contains(self, field, value):
166+
self.lastANDOR = 'AND' if (self.lastANDOR is None) else 'OR'
167+
self.query.add_condition(self.lastANDOR, field, 'NOT LIKE', '%' + value + '%')
168+
return self
169+
160170
def or_where_in(self, field, value):
161171
self.lastANDOR = 'AND' if (self.lastANDOR is None) else 'OR'
162172
self.query.add_condition(self.lastANDOR, field, 'IN', value)

build/lib/sbxpy/service/__init__.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ async def get(
2424
cache_key = f"sbx:{result_type.get_model()}:{key}"
2525
cached_keys: Set[str] = set()
2626
model_instance = None
27-
try:
28-
29-
await redis_service.get_connection()
30-
cached_keys: Set[str] = set(
31-
await redis_service.get_keys_index(keys_idx) or []
32-
)
33-
if use_cache and key in cached_keys:
34-
model_instance = await redis_service.get_object(cache_key, result_type)
35-
if model_instance:
36-
return model_instance
37-
except Exception as e:
38-
logger.exception(f"An error occurred while retrieving data: {e}")
39-
27+
await redis_service.get_connection()
28+
if use_cache:
29+
try:
30+
cached_keys: Set[str] = set(
31+
await redis_service.get_keys_index(keys_idx) or []
32+
)
33+
if key in cached_keys:
34+
model_instance = await redis_service.get_object(cache_key, result_type)
35+
if model_instance:
36+
return model_instance
37+
except Exception as e:
38+
logger.exception(f"An error occurred while retrieving data: {e}")
4039
try:
4140
query = SBXCachedService.find(result_type.get_model())
4241
query.where_with_keys([key])

dist/sbxpy-0.6.7-py3-none-any.whl

-13.2 KB
Binary file not shown.

dist/sbxpy-0.6.8-py3-none-any.whl

13.3 KB
Binary file not shown.

sbxpy.egg-info/PKG-INFO

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Metadata-Version: 2.1
1+
Metadata-Version: 2.2
22
Name: sbxpy
33
Version: 0.6.8
44
Summary: This is the module create all request used to communicate with SbxCloud
@@ -10,5 +10,17 @@ Classifier: License :: OSI Approved :: MIT License
1010
Classifier: Operating System :: OS Independent
1111
Description-Content-Type: text/markdown
1212
License-File: LICENSE
13+
Requires-Dist: aiohttp>=3.7.3
14+
Requires-Dist: redis>=4.5.2
15+
Requires-Dist: pydantic>2.1.0
16+
Requires-Dist: deepmerge>=1.1.0
17+
Dynamic: author
18+
Dynamic: author-email
19+
Dynamic: classifier
20+
Dynamic: description
21+
Dynamic: description-content-type
22+
Dynamic: home-page
23+
Dynamic: requires-dist
24+
Dynamic: summary
1325

1426
This is the module create all request used to communicate with SbxCloud

0 commit comments

Comments
 (0)