python3-commons 0.7.5__py3-none-any.whl → 0.7.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,16 +20,23 @@ def get_query(search: Mapping[str, str] | None = None,
20
20
  3: exact match if True, LIKE %value% if False
21
21
  """
22
22
 
23
+ order_by_cols = {}
24
+
23
25
  if order_by:
24
- if order_by.startswith('-'):
25
- direction = desc
26
- order_by = order_by[1:]
27
- else:
28
- direction = asc
26
+ for order_by_col in order_by.split(','):
27
+ if order_by_col.startswith('-'):
28
+ direction = desc
29
+ order_by_col = order_by_col[1:]
30
+ else:
31
+ direction = asc
32
+
33
+ order_by_cols[order_by_col] = direction
29
34
 
30
- order_by_clause = direction(columns[order_by][0])
35
+ order_by_clauses = tuple(
36
+ direction(columns[order_by_col][0]) for order_by_col, direction in order_by_cols.items()
37
+ )
31
38
  else:
32
- order_by_clause = None
39
+ order_by_clauses = None
33
40
 
34
41
  if search:
35
42
  where_parts = [
@@ -58,4 +65,4 @@ def get_query(search: Mapping[str, str] | None = None,
58
65
  else:
59
66
  where_clause = None
60
67
 
61
- return where_clause, order_by_clause
68
+ return where_clause, order_by_clauses
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: python3-commons
3
- Version: 0.7.5
3
+ Version: 0.7.6
4
4
  Summary: Re-usable Python3 code
5
5
  Author-email: Oleg Korsak <kamikaze.is.waiting.you@gmail.com>
6
6
  License: gpl-3
@@ -7,7 +7,7 @@ python3_commons/helpers.py,sha256=OmuCF7UeJ6oe-rH1Y4ZYVW_uPQ973lCLsikj01wmNqs,31
7
7
  python3_commons/object_storage.py,sha256=Bte49twIJ4l6VAzIqK6tLx7DFYwijErUmmhWkrZpSJE,4074
8
8
  python3_commons/permissions.py,sha256=V6kT7gBQ0fZRDQwreM9es90BvvpB3gUofuqnFvx2g-o,1553
9
9
  python3_commons/db/__init__.py,sha256=pZk0Fv-Le2sFC-KaVDdJjDDsHtmv-IJz_aFP5o2PGHA,1682
10
- python3_commons/db/helpers.py,sha256=6xYgDgMhWUpVbtD3FctYtHVBRNahCkkpVIxx0matt-c,1644
10
+ python3_commons/db/helpers.py,sha256=0z-pXAxQg0KqrqfoUcRooRHNrrKi-g2mSO6euVMscpE,1891
11
11
  python3_commons/db/models/__init__.py,sha256=AeeTLUqdqQrhCTi14ACWO0ccyVyWFppZVtCeWShSvR0,193
12
12
  python3_commons/db/models/auth.py,sha256=ctHiz_5x17TdXac7a3SjfuZ0-nEgnxK7RwKOY8qflZc,1195
13
13
  python3_commons/db/models/common.py,sha256=ScFEL04HwEomX3X7f8WHMq505uvoID6itBETRWfya9w,1402
@@ -19,9 +19,9 @@ python3_commons/serializers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
19
19
  python3_commons/serializers/json.py,sha256=P288wWz9ic38QWEMrpp_uwKPYkQiOgvE1cI4WZn6ZCg,808
20
20
  python3_commons/serializers/msgpack.py,sha256=tzIGGyDL3UpZnnouCtnxuYDx6InKM_C3PP1N4PN8wd4,1269
21
21
  python3_commons/serializers/msgspec.py,sha256=FuZVqOLJb0-lEKrs7dtjhwEbHIpfMUk5yu1hD64zRdc,2038
22
- python3_commons-0.7.5.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
23
- python3_commons-0.7.5.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
24
- python3_commons-0.7.5.dist-info/METADATA,sha256=hHvrO14nJy917lS-gySmCIGJ5kc-6X4Bf7Zq8EHbgTo,1127
25
- python3_commons-0.7.5.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
26
- python3_commons-0.7.5.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
27
- python3_commons-0.7.5.dist-info/RECORD,,
22
+ python3_commons-0.7.6.dist-info/AUTHORS.rst,sha256=3R9JnfjfjH5RoPWOeqKFJgxVShSSfzQPIrEr1nxIo9Q,90
23
+ python3_commons-0.7.6.dist-info/LICENSE,sha256=xxILuojHm4fKQOrMHPSslbyy6WuKAN2RiG74HbrYfzM,34575
24
+ python3_commons-0.7.6.dist-info/METADATA,sha256=GtDliyLHNI1Y-zqZCrMXr7ggUb98BhvLffLIu3ROTIs,1127
25
+ python3_commons-0.7.6.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
26
+ python3_commons-0.7.6.dist-info/top_level.txt,sha256=lJI6sCBf68eUHzupCnn2dzG10lH3jJKTWM_hrN1cQ7M,16
27
+ python3_commons-0.7.6.dist-info/RECORD,,