Skip to content

Commit 081d1d2

Browse files
authored
Merge pull request #8 from CrispenGari/utilities
Utilities
2 parents e238237 + 0baf174 commit 081d1d2

22 files changed

+2320
-103
lines changed

Changelog.md

Lines changed: 84 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,81 @@
11
===
2-
Dataloom **`2.1.1`**
2+
Dataloom **`2.2.0`**
33
===
44

55
### Release Notes - `dataloom`
66

7-
We have release the new `dataloom` Version `2.1.0` (`2024-02-24`)
7+
We have release the new `dataloom` Version `2.2.0` (`2024-02-24`)
8+
9+
##### Features
10+
11+
- updated documentation.
12+
- Added operators `BETWEEN` and `NOT` in filters now ypu can use them.
13+
14+
```py
15+
post = loom.find_one(
16+
Post,
17+
filters=Filter(
18+
column="id",
19+
operator="between",
20+
value=[1, 7],
21+
),
22+
select=["id"],
23+
)
24+
post = loom.find_one(
25+
Post,
26+
filters=Filter(
27+
column="id",
28+
operator="not",
29+
value=3,
30+
),
31+
select=["id"],
32+
)
33+
```
34+
35+
> Note that the `between` operator works on value ranges that are numbers.
36+
37+
- Distinct row selection has been added for the method `find_all()` and `find_many()`
38+
39+
```py
40+
post = loom.find_many(
41+
Post,
42+
filters=Filter(
43+
column="id",
44+
operator="between",
45+
value=[1, 7],
46+
),
47+
select=["completed"],
48+
distinct=True,
49+
)
50+
51+
post = loom.find_all(
52+
Post,
53+
select=["completed"],
54+
distinct=True,
55+
)
56+
```
57+
58+
> The result will return the `distinct` rows of data based on the completed value.
59+
60+
- added utility functions `sum`, `avg`, `min`, `max` and `count` to the loom object.
61+
```py
62+
count = loom.count(
63+
instance=Post,
64+
filters=Filter(
65+
column="id",
66+
operator="between",
67+
value=[1, 7],
68+
),
69+
column="id",
70+
)
71+
```
72+
- Updated logger colors and formatting.
73+
74+
# Dataloom **`2.1.1`**
75+
76+
### Release Notes - `dataloom`
77+
78+
We have release the new `dataloom` Version `2.1.1` (`2024-02-24`)
879

980
##### Features
1081

@@ -70,7 +141,7 @@ We have release the new `dataloom` Version `2.0.0` (`2024-02-21`)
70141
- Now you can fetch your child relationship together in your query
71142

72143
```py
73-
user = mysql_loom.find_one(
144+
user = loom.find_one(
74145
instance=User,
75146
filters=[Filter(column="id", value=userId)],
76147
include=[Include(model=Profile, select=["id", "avatar"], has="one")],
@@ -81,7 +152,7 @@ We have release the new `dataloom` Version `2.0.0` (`2024-02-21`)
81152
- You can apply limits, offsets, filters and orders to your child associations during queries
82153

83154
```py
84-
post = mysql_loom.find_one(
155+
post = loom.find_one(
85156
instance=Post,
86157
filters=[Filter(column="userId", value=userId)],
87158
select=["title", "id"],
@@ -124,7 +195,7 @@ We have release the new `dataloom` Version `2.0.0` (`2024-02-21`)
124195

125196
# now you can do this
126197

127-
profile = mysql_loom.find_many(
198+
profile = loom.find_many(
128199
instance=Profile,
129200
)
130201
print([Profile(**p) for p in profile]) # ? = [<Profile:id=1>]
@@ -140,20 +211,20 @@ We have release the new `dataloom` Version `2.0.0` (`2024-02-21`)
140211
- **Before**
141212

142213
```py
143-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # invalid
144-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # invalid
145-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select="id") # invalid
146-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid
214+
res = loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # invalid
215+
res = loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # invalid
216+
res = loom.find_by_pk(Profile, pk=profileId, select="id") # invalid
217+
res = loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid
147218

148219
```
149220

150221
- **Now**
151222

152223
```py
153-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # valid
154-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # valid
155-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select="id") # valid
156-
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid
224+
res = loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # valid
225+
res = loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # valid
226+
res = loom.find_by_pk(Profile, pk=profileId, select="id") # valid
227+
res = loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid
157228

158229
```
159230

README.md

Lines changed: 182 additions & 13 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)