Skip to content

Commit

Permalink
Merge pull request #8 from CrispenGari/utilities
Browse files Browse the repository at this point in the history
Utilities
  • Loading branch information
CrispenGari authored Feb 25, 2024
2 parents e238237 + 0baf174 commit 081d1d2
Show file tree
Hide file tree
Showing 22 changed files with 2,320 additions and 103 deletions.
97 changes: 84 additions & 13 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,81 @@
===
Dataloom **`2.1.1`**
Dataloom **`2.2.0`**
===

### Release Notes - `dataloom`

We have release the new `dataloom` Version `2.1.0` (`2024-02-24`)
We have release the new `dataloom` Version `2.2.0` (`2024-02-24`)

##### Features

- updated documentation.
- Added operators `BETWEEN` and `NOT` in filters now ypu can use them.

```py
post = loom.find_one(
Post,
filters=Filter(
column="id",
operator="between",
value=[1, 7],
),
select=["id"],
)
post = loom.find_one(
Post,
filters=Filter(
column="id",
operator="not",
value=3,
),
select=["id"],
)
```

> Note that the `between` operator works on value ranges that are numbers.
- Distinct row selection has been added for the method `find_all()` and `find_many()`

```py
post = loom.find_many(
Post,
filters=Filter(
column="id",
operator="between",
value=[1, 7],
),
select=["completed"],
distinct=True,
)

post = loom.find_all(
Post,
select=["completed"],
distinct=True,
)
```

> The result will return the `distinct` rows of data based on the completed value.
- added utility functions `sum`, `avg`, `min`, `max` and `count` to the loom object.
```py
count = loom.count(
instance=Post,
filters=Filter(
column="id",
operator="between",
value=[1, 7],
),
column="id",
)
```
- Updated logger colors and formatting.

# Dataloom **`2.1.1`**

### Release Notes - `dataloom`

We have release the new `dataloom` Version `2.1.1` (`2024-02-24`)

##### Features

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

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

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

# now you can do this

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

```py
res = mysql_loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # invalid
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # invalid
res = mysql_loom.find_by_pk(Profile, pk=profileId, select="id") # invalid
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid
res = loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # invalid
res = loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # invalid
res = loom.find_by_pk(Profile, pk=profileId, select="id") # invalid
res = loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid

```

- **Now**

```py
res = mysql_loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # valid
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # valid
res = mysql_loom.find_by_pk(Profile, pk=profileId, select="id") # valid
res = mysql_loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid
res = loom.find_by_pk(Profile, pk=profileId, select={"id", "avatar"}) # valid
res = loom.find_by_pk(Profile, pk=profileId, select=("id", "avatar")) # valid
res = loom.find_by_pk(Profile, pk=profileId, select="id") # valid
res = loom.find_by_pk(Profile, pk=profileId, select=["id"]) # valid

```

Expand Down
195 changes: 182 additions & 13 deletions README.md

Large diffs are not rendered by default.

Loading

0 comments on commit 081d1d2

Please sign in to comment.