Skip to content

Commit fc4d3e6

Browse files
committed
chore: update example dates to 2022-02-22
1 parent 7254195 commit fc4d3e6

4 files changed

Lines changed: 24 additions & 24 deletions

File tree

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const getEvents = defineQuery<{
5050
const { sql } = getEvents({
5151
tableName: 'prod_events',
5252
status: 'active',
53-
startDate: '2024-01-01',
53+
startDate: '2022-02-22',
5454
orderBy: 'created_at',
5555
limit: 100,
5656
});
@@ -62,7 +62,7 @@ Result:
6262
SELECT event_id, event_name
6363
FROM prod_events
6464
WHERE status = 'active'
65-
AND created_at >= '2024-01-01'
65+
AND created_at >= '2022-02-22'
6666
ORDER BY created_at
6767
LIMIT 100
6868
```
@@ -85,7 +85,7 @@ const getEvents = defineQuery('./queries/getEvents.sql', {
8585
const { sql } = getEvents({
8686
tableName: 'prod_events',
8787
status: 'active',
88-
startDate: '2024-01-01',
88+
startDate: '2022-02-22',
8989
orderBy: 'created_at',
9090
limit: 100,
9191
});
@@ -98,8 +98,8 @@ const { sql } = getEvents({
9898
| `schema.string` | Any string (with SQL injection check) | `'hello'` |
9999
| `schema.number` | Finite number | `42`, `3.14` |
100100
| `schema.boolean` | `true` / `false` | `true` |
101-
| `schema.isoDate` | `YYYY-MM-DD` | `'2026-04-01'` |
102-
| `schema.isoTimestamp` | ISO 8601 with timezone | `'2026-04-01T13:57:34.000Z'` |
101+
| `schema.isoDate` | `YYYY-MM-DD` | `'2022-02-22'` |
102+
| `schema.isoTimestamp` | ISO 8601 with timezone | `'2022-02-22T13:57:34.000Z'` |
103103
| `schema.identifier` | SQL identifier (up to `db.schema.table`) | `'public.users'` |
104104
| `schema.uuid` | RFC 4122 UUID | `'550e8400-e29b-41d4-a716-446655440000'` |
105105
| `schema.positiveInt` | Positive integer | `100` |

llms.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const getEvents = defineQuery('./queries/getEvents.sql', {
3939
const { sql } = getEvents({
4040
tableName: 'prod_events',
4141
status: 'active',
42-
startDate: '2024-01-01',
42+
startDate: '2022-02-22',
4343
orderBy: 'created_at',
4444
limit: 100,
4545
});
@@ -53,7 +53,7 @@ Schema mode validates at define-time (schema keys must match template tokens) an
5353
- `schema.number` - finite number (rejects NaN, Infinity)
5454
- `schema.boolean` - true or false
5555
- `schema.isoDate` - YYYY-MM-DD with calendar validation
56-
- `schema.isoTimestamp` - ISO 8601 with timezone (e.g. 2024-01-01T00:00:00Z)
56+
- `schema.isoTimestamp` - ISO 8601 with timezone (e.g. 2022-02-22T00:00:00Z)
5757
- `schema.identifier` - SQL identifier, up to 3 dot-separated parts (db.schema.table)
5858
- `schema.uuid` - RFC 4122 UUID
5959
- `schema.positiveInt` - integer greater than 0

tests/define-query.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ describe('defineQuery — schema mode', () => {
6363
const { sql } = getEvents({
6464
tableName: 'prod_events',
6565
status: 'active',
66-
startDate: '2024-01-01',
66+
startDate: '2022-02-22',
6767
orderBy: 'created_at',
6868
limit: 100,
6969
});
7070

7171
expect(sql).toContain('prod_events');
7272
expect(sql).toContain("status = 'active'");
73-
expect(sql).toContain("created_at >= '2024-01-01'");
73+
expect(sql).toContain("created_at >= '2022-02-22'");
7474
expect(sql).toContain('created_at');
7575
expect(sql).toContain('100');
7676
});

tests/schema.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('schema.string', () => {
66
expect(schema.string.validate('hello')).toBe(true);
77
expect(schema.string.validate('')).toBe(true);
88
expect(schema.string.validate('prod_events')).toBe(true);
9-
expect(schema.string.validate('2024-01-01')).toBe(true);
9+
expect(schema.string.validate('2022-02-22')).toBe(true);
1010
});
1111

1212
it('rejects non-strings', () => {
@@ -62,15 +62,15 @@ describe('schema.boolean', () => {
6262

6363
describe('schema.isoDate', () => {
6464
it('accepts valid dates', () => {
65-
expect(schema.isoDate.validate('2026-04-01')).toBe(true);
65+
expect(schema.isoDate.validate('2022-02-22')).toBe(true);
6666
expect(schema.isoDate.validate('2000-01-31')).toBe(true);
6767
});
6868

6969
it('rejects invalid formats', () => {
70-
expect(schema.isoDate.validate('04-01-2026')).toBe(false);
71-
expect(schema.isoDate.validate('2026/04/01')).toBe(false);
72-
expect(schema.isoDate.validate('2026-4-1')).toBe(false);
73-
expect(schema.isoDate.validate('2026-04-01T00:00:00Z')).toBe(false);
70+
expect(schema.isoDate.validate('02-22-2022')).toBe(false);
71+
expect(schema.isoDate.validate('2022/02/22')).toBe(false);
72+
expect(schema.isoDate.validate('2022-2-22')).toBe(false);
73+
expect(schema.isoDate.validate('2022-02-22T00:00:00Z')).toBe(false);
7474
expect(schema.isoDate.validate('')).toBe(false);
7575
expect(schema.isoDate.validate(123)).toBe(false);
7676
});
@@ -91,17 +91,17 @@ describe('schema.isoDate', () => {
9191

9292
describe('schema.isoTimestamp', () => {
9393
it('accepts valid timestamps', () => {
94-
expect(schema.isoTimestamp.validate('2026-04-01T13:57:34Z')).toBe(true);
95-
expect(schema.isoTimestamp.validate('2026-04-01T13:57:34.000Z')).toBe(true);
96-
expect(schema.isoTimestamp.validate('2026-04-01T13:57:34.123456Z')).toBe(true);
97-
expect(schema.isoTimestamp.validate('2026-04-01T13:57:34+03:00')).toBe(true);
98-
expect(schema.isoTimestamp.validate('2026-04-01T13:57:34-05:00')).toBe(true);
94+
expect(schema.isoTimestamp.validate('2022-02-22T13:57:34Z')).toBe(true);
95+
expect(schema.isoTimestamp.validate('2022-02-22T13:57:34.000Z')).toBe(true);
96+
expect(schema.isoTimestamp.validate('2022-02-22T13:57:34.123456Z')).toBe(true);
97+
expect(schema.isoTimestamp.validate('2022-02-22T13:57:34+03:00')).toBe(true);
98+
expect(schema.isoTimestamp.validate('2022-02-22T13:57:34-05:00')).toBe(true);
9999
});
100100

101101
it('rejects invalid formats', () => {
102-
expect(schema.isoTimestamp.validate('2026-04-01')).toBe(false);
103-
expect(schema.isoTimestamp.validate('2026-04-01 13:57:34')).toBe(false);
104-
expect(schema.isoTimestamp.validate('2026-04-01T13:57:34')).toBe(false);
102+
expect(schema.isoTimestamp.validate('2022-02-22')).toBe(false);
103+
expect(schema.isoTimestamp.validate('2022-02-22 13:57:34')).toBe(false);
104+
expect(schema.isoTimestamp.validate('2022-02-22T13:57:34')).toBe(false);
105105
expect(schema.isoTimestamp.validate('not-a-timestamp')).toBe(false);
106106
expect(schema.isoTimestamp.validate(123)).toBe(false);
107107
});
@@ -189,7 +189,7 @@ describe('schema.s3Path', () => {
189189
it('accepts valid S3 paths', () => {
190190
expect(schema.s3Path.validate('s3://my-bucket/data/')).toBe(true);
191191
expect(schema.s3Path.validate('s3://my-bucket/path/to/file.parquet')).toBe(true);
192-
expect(schema.s3Path.validate('s3://bucket123/year=2024/month=01/')).toBe(true);
192+
expect(schema.s3Path.validate('s3://bucket123/year=2022/month=02/')).toBe(true);
193193
expect(schema.s3Path.validate('s3://my-bucket')).toBe(true);
194194
});
195195

0 commit comments

Comments
 (0)