orange-orm 5.2.0-beta.0 → 5.2.0

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.
package/README.md CHANGED
@@ -634,8 +634,6 @@ The following operators are supported:
634
634
  - max
635
635
  - avg
636
636
 
637
- For distinct rows across selected fields, you can use `table.distinct(...)`.
638
-
639
637
  You can also elevate associated data to a parent level for easier access. In the example below, <i>balance</i> of the customer is elevated to the root level.
640
638
 
641
639
  ```javascript
@@ -653,19 +651,6 @@ async function getRows() {
653
651
  }
654
652
  ```
655
653
 
656
- ```javascript
657
- import map from './map';
658
- const db = map.sqlite('demo.db');
659
-
660
- getDistinct();
661
-
662
- async function getDistinct() {
663
- const rows = await db.orderLine.distinct({
664
- orderId: x => x.orderId
665
- });
666
- }
667
- ```
668
-
669
654
  __Many rows filtered__
670
655
 
671
656
  ```javascript
@@ -1806,6 +1791,21 @@ async function getRows() {
1806
1791
  });
1807
1792
  }
1808
1793
  ```
1794
+ __Count__
1795
+ Use <i>count</i> on a relation in a filter to compare how many related rows match a condition.
1796
+ ```javascript
1797
+ import map from './map';
1798
+ const db = map.sqlite('demo.db');
1799
+
1800
+ getRows();
1801
+
1802
+ async function getRows() {
1803
+ const rows = await db.order.getMany({
1804
+ where: x => x.lines.count().le(1)
1805
+ .and(x.lines.count(line => line.product.contains('guitar')).eq(1))
1806
+ });
1807
+ }
1808
+ ```
1809
1809
 
1810
1810
  </details>
1811
1811
 
@@ -2315,24 +2315,6 @@ async function getAggregates() {
2315
2315
  }
2316
2316
  ```
2317
2317
 
2318
- __Distinct__
2319
- Use `distinct` when you want unique combinations of selected fields.
2320
- When only plain columns are selected, this uses SQL `DISTINCT`.
2321
- If aggregate expressions are included, it falls back to `GROUP BY`.
2322
-
2323
- ```javascript
2324
- import map from './map';
2325
- const db = map.sqlite('demo.db');
2326
-
2327
- getDistinctRows();
2328
-
2329
- async function getDistinctRows() {
2330
- const rows = await db.orderLine.distinct({
2331
- orderId: x => x.orderId
2332
- });
2333
- }
2334
- ```
2335
-
2336
2318
  __Count__
2337
2319
  For convenience, you can use the <i>count</i> directly on the table instead of using the aggregated query syntax.
2338
2320
  ```javascript
package/docs/changelog.md CHANGED
@@ -1,4 +1,8 @@
1
1
  ## Changelog
2
+ __5.2.0__
3
+ Distinct aggregates via `distinct()` [#119](https://github.com/alfateam/orange-orm/issues/119)
4
+ Column-to-column filters (incl. `contains`, `startsWith`, `endsWith`) [#150](htps://github.com/alfateam/orange-orm/issues/150)
5
+ Relation count filters: `x.lines.count()` with optional predicate [#151](htps://github.com/alfateam/orange-orm/issues/151)
2
6
  __5.1.0__
3
7
  Support for Hono [#149](https://github.com/alfateam/orange-orm/issues/149)
4
8
  Removed dependency `glob`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orange-orm",
3
- "version": "5.2.0-beta.0",
3
+ "version": "5.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/other.db DELETED
Binary file