@truto/sqlite-builder 2.0.2-canary.20 → 2.0.2-canary.21

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 +25 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,28 +1,28 @@
1
- verified_at: { exists: true },
2
- },
1
+ const results = db.prepare(complexQuery.text).all(...complexQuery.values)
2
+ ```
3
3
 
4
- // Recent orders
5
- $recent_orders: {
6
- created_at: { gte: '2024-01-01' },
7
- status: { in: ['completed', 'shipped'] },
8
- total: { gt: 50 },
9
- },
10
- }
4
+ #### Kitchen Sink Examples
5
+
6
+ Real-world complex filters:
11
7
 
12
- const complexQuery = sql`
13
- SELECT
14
- u.id,
15
- u.name,
16
- u.email,
17
- p.verified_at,
18
- COUNT(ro.id) as recent_order_count,
19
- SUM(ro.total) as recent_order_total
20
- FROM users u
21
- JOIN profiles p ON u.id = p.user_id
22
- JOIN orders ro ON u.id = ro.user_id
23
- WHERE ${compileFilter(userOrderFilter)}
24
- GROUP BY u.id, u.name, u.email, p.verified_at
25
- HAVING recent_order_count > 0
26
- ORDER BY recent_order_total DESC
27
- `
8
+ ```typescript
9
+ // Active users in specific regions, either minors/seniors or VIP
10
+ const complexFilter = {
11
+ and: [
12
+ { status: 'ACTIVE' },
13
+ { or: [{ age: { lt: 18 } }, { age: { gte: 65 } }, { membership: 'VIP' }] },
14
+ { country: { in: ['US', 'CA', 'GB'] } },
15
+ { email: { exists: true } },
16
+ { 'profile.verified': true },
17
+ ],
18
+ }
28
19
 
20
+ // Content filtering with multiple criteria
21
+ const contentFilter = {
22
+ name: { like: 'Project%' },
23
+ category: { nin: ['ARCHIVED', 'DELETED', 'SPAM'] },
24
+ created_at: { exists: true },
25
+ or: [
26
+ { tags: { ilike: '%important%' } },
27
+ { priority: { gte: 8 } },
28
+ { 'metadata.featured': true },
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@truto/sqlite-builder","version":"2.0.2-canary.20","description":"debug canary","license":"MIT","main":"index.js"}
1
+ {"name":"@truto/sqlite-builder","version":"2.0.2-canary.21","description":"debug canary","license":"MIT","main":"index.js"}