Update query wrapper to add key__mod=value kwargs
This commit is contained in:
parent
5bab8af598
commit
0d2d55ca40
2 changed files with 4 additions and 1 deletions
|
@ -37,5 +37,8 @@ def q(**kwargs: dict) -> dict:
|
||||||
for k, v in kwargs.items():
|
for k, v in kwargs.items():
|
||||||
if k == "_id":
|
if k == "_id":
|
||||||
v = ObjectId(v)
|
v = ObjectId(v)
|
||||||
|
elif "__" in k:
|
||||||
|
k, mod, *_ = k.split("__")
|
||||||
|
v = {f"${mod}": v}
|
||||||
query[k] = v
|
query[k] = v
|
||||||
return query
|
return query
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "jarvis-core"
|
name = "jarvis-core"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Your Name <you@example.com>"]
|
authors = ["Your Name <you@example.com>"]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue