@dreamtree-org/korm-js 1.0.44 → 1.0.45

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.
Files changed (2) hide show
  1. package/README.md +49 -30
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -175,9 +175,9 @@ POST /api/Users/crud
175
175
  {
176
176
  "action": "list",
177
177
  "where": {
178
- "first_name": { "like": "%John%" },
179
- "email": { "like": "%@example.com" },
180
- "age": { ">=": 18, "<=": 65 },
178
+ "first_name": "%John%",
179
+ "email": "%@example.com",
180
+ "age": "><18,65",
181
181
  "is_active": true
182
182
  },
183
183
  "select": ["id", "username", "email", "first_name", "last_name"],
@@ -315,7 +315,7 @@ POST /api/Users/crud
315
315
  "action": "count",
316
316
  "where": {
317
317
  "is_active": true,
318
- "created_at": { ">=": "2024-01-01" }
318
+ "created_at": ">=2024-01-01"
319
319
  }
320
320
  }
321
321
 
@@ -386,7 +386,7 @@ POST /api/Users/crud
386
386
  },
387
387
  "conflict": ["username"],
388
388
  "where": {
389
- "created_at": { "<": "2024-01-01" }
389
+ "created_at": "<2024-01-01"
390
390
  }
391
391
  }
392
392
 
@@ -411,11 +411,11 @@ POST /api/Users/crud
411
411
  {
412
412
  "action": "list",
413
413
  "where": {
414
- "age": { ">=": 18, "<=": 65 },
415
- "email": { "like": "%@example.com" },
416
- "first_name": { "in": ["John", "Jane", "Bob"] },
414
+ "age": "><18,65",
415
+ "email": "%@example.com",
416
+ "first_name": "[]John,Jane,Bob",
417
417
  "is_active": true,
418
- "created_at": { ">=": "2024-01-01", "<=": "2024-12-31" }
418
+ "created_at": "><2024-01-01,2024-12-31"
419
419
  }
420
420
  }
421
421
 
@@ -440,7 +440,7 @@ POST /api/Users/crud
440
440
  "action": "list",
441
441
  "where": {
442
442
  "status": "active",
443
- "Or:name": "like:%john%"
443
+ "Or:name": "%john%"
444
444
  }
445
445
  }
446
446
  // Generated SQL: WHERE status = 'active' OR name LIKE '%john%'
@@ -463,7 +463,7 @@ POST /api/Users/crud
463
463
  "action": "list",
464
464
  "where": {
465
465
  "status": "active",
466
- "age": { ">=": 18 },
466
+ "age": ">=18",
467
467
  "Or:role": "admin",
468
468
  "Or:role": "super_admin"
469
469
  }
@@ -476,8 +476,8 @@ POST /api/Users/crud
476
476
  "action": "list",
477
477
  "where": {
478
478
  "department": "sales",
479
- "Or:email": { "like": "%@company.com" },
480
- "Or:created_at": { ">=": "2024-01-01" }
479
+ "Or:email": "%@company.com",
480
+ "Or:created_at": ">=2024-01-01"
481
481
  }
482
482
  }
483
483
  // Generated SQL: WHERE department = 'sales' OR email LIKE '%@company.com' OR created_at >= '2024-01-01'
@@ -527,7 +527,7 @@ POST /api/Users/crud
527
527
  {
528
528
  "action": "list",
529
529
  "where": [
530
- { "is_active": true, "age": { ">=": 18 } },
530
+ { "is_active": true, "age": ">=18" },
531
531
  { "Or:status": "verified" },
532
532
  { "Or:role": "admin" }
533
533
  ]
@@ -541,7 +541,7 @@ POST /api/Users/crud
541
541
  "where": [
542
542
  { "department": "engineering" },
543
543
  { "Or:department": "product" },
544
- { "created_at": { ">=": "2024-01-01" } }
544
+ { "created_at": ">=2024-01-01" }
545
545
  ]
546
546
  }
547
547
  // Generated SQL: WHERE department = 'engineering' OR department = 'product' AND created_at >= '2024-01-01'
@@ -549,21 +549,40 @@ POST /api/Users/crud
549
549
 
550
550
  ### Where Operators Reference
551
551
 
552
- | Operator | Description | Example |
553
- |----------|-------------|---------|
554
- | `=` (default) | Equals | `"status": "active"` |
555
- | `>=` | Greater than or equal | `"age": { ">=": 18 }` |
556
- | `<=` | Less than or equal | `"age": { "<=": 65 }` |
557
- | `>` | Greater than | `"price": { ">": 100 }` |
558
- | `<` | Less than | `"price": { "<": 500 }` |
559
- | `!=` | Not equal | `"status": { "!=": "deleted" }` |
560
- | `like` | Pattern matching | `"name": { "like": "%john%" }` |
561
- | `in` | Value in list | `"status": ["active", "pending"]` |
562
- | `notIn` | Value not in list | `"role": { "notIn": ["banned", "suspended"] }` |
563
- | `between` | Range (inclusive) | `"age": { "between": [18, 65] }` |
564
- | `notBetween` | Outside range | `"score": { "notBetween": [0, 50] }` |
565
- | `null` | IS NULL check | `"deleted_at": null` |
566
- | `Or:column` | OR condition prefix | `"Or:name": "John"` |
552
+ | Operator | Description | Syntax | Example |
553
+ |----------|-------------|--------|---------|
554
+ | `=` (default) | Equals | `value` | `"status": "active"` |
555
+ | `>=` | Greater than or equal | `>=value` | `"age": ">=18"` |
556
+ | `<=` | Less than or equal | `<=value` | `"age": "<=65"` |
557
+ | `>` | Greater than | `>value` | `"price": ">100"` |
558
+ | `<` | Less than | `<value` | `"price": "<500"` |
559
+ | `!=` | Not equal | `!value` | `"status": "!deleted"` |
560
+ | `like` | Pattern matching (auto) | `%value%` | `"name": "%john%"` |
561
+ | `in` | Value in list | `[]val1,val2` | `"status": "[]active,pending"` |
562
+ | `notIn` | Value not in list | `![]val1,val2` | `"role": "![]banned,suspended"` |
563
+ | `between` | Range (inclusive) | `><min,max` | `"age": "><18,65"` |
564
+ | `notBetween` | Outside range | `<>min,max` | `"score": "<>0,50"` |
565
+ | `null` | IS NULL check | `null` | `"deleted_at": null` |
566
+ | `Or:column` | OR condition prefix | `Or:column` | `"Or:name": "John"` |
567
+
568
+ **Examples:**
569
+
570
+ ```javascript
571
+ // Complex query with string-based operators
572
+ POST /api/Users/crud
573
+ {
574
+ "action": "list",
575
+ "where": {
576
+ "age": ">=18",
577
+ "status": "!deleted",
578
+ "name": "%john%",
579
+ "role": "[]admin,moderator,editor",
580
+ "score": "><50,100"
581
+ }
582
+ }
583
+ // SQL: WHERE age >= 18 AND status != 'deleted' AND name LIKE '%john%'
584
+ // AND role IN ('admin', 'moderator', 'editor') AND score BETWEEN 50 AND 100
585
+ ```
567
586
 
568
587
  ### Sorting
569
588
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamtree-org/korm-js",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "description": "Knowledge Object-Relational Mapping - A powerful, modular ORM system for Node.js with dynamic database operations, complex queries, relationships, and nested requests",
5
5
  "author": {
6
6
  "name": "Partha Preetham Krishna",