mikro-orm-temporal 1.2.0 → 2.0.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 +24 -9
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -13,6 +13,9 @@ The library exports the following types:
|
|
|
13
13
|
- `PlainDateTimeType`
|
|
14
14
|
- `PlainTimeType`
|
|
15
15
|
- `OffsetDateTimeType`
|
|
16
|
+
- `InstantType`
|
|
17
|
+
- `PlainMonthDayType`
|
|
18
|
+
- `PlainYearMonthType`
|
|
16
19
|
|
|
17
20
|
## Installation
|
|
18
21
|
|
|
@@ -28,15 +31,27 @@ yarn add mikro-orm-temporal
|
|
|
28
31
|
|
|
29
32
|
## Usage
|
|
30
33
|
|
|
34
|
+
### With `defineEntity` (recommended)
|
|
35
|
+
|
|
36
|
+
Use `p.type()` from `@mikro-orm/core` to wire up any temporal type, then chain modifiers like
|
|
37
|
+
`.nullable()` as needed:
|
|
38
|
+
|
|
31
39
|
```ts
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
import { defineEntity, p } from '@mikro-orm/core';
|
|
41
|
+
import { OffsetDateTimeType, PlainDateType } from 'mikro-orm-temporal';
|
|
42
|
+
|
|
43
|
+
const EventSchema = defineEntity({
|
|
44
|
+
name: 'Event',
|
|
45
|
+
properties: {
|
|
46
|
+
id: p.integer().primary(),
|
|
47
|
+
startsAt: p.type(OffsetDateTimeType),
|
|
48
|
+
endsAt: () => p.type(OffsetDateTimeType).nullable(),
|
|
49
|
+
date: p.type(PlainDateType),
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export class Event extends EventSchema.class {}
|
|
54
|
+
EventSchema.setClass(Event);
|
|
40
55
|
```
|
|
41
56
|
|
|
42
57
|
## Caveats
|
|
@@ -44,5 +59,5 @@ export class HelloWorld {
|
|
|
44
59
|
Due to MikroORM not distinguishing between timestamps with and without timezone and some other quirks, this library
|
|
45
60
|
makes some assumptions and decisions:
|
|
46
61
|
|
|
47
|
-
- Durations are stored as `INTERVAL` in Postgres and as `
|
|
62
|
+
- Durations are stored as `INTERVAL` in Postgres and as `VARCHAR` (ISO string) on all other platforms.
|
|
48
63
|
- `PlainDateTime` is stored as `VARCHAR(19)` on MSSQL, as Tedious introduces timezone issues.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mikro-orm-temporal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Temporal types for Mikro ORM",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ben Scholzen 'DASPRiD'",
|
|
@@ -47,12 +47,12 @@
|
|
|
47
47
|
"@biomejs/biome": "2.2.7",
|
|
48
48
|
"@commitlint/cli": "^20.1.0",
|
|
49
49
|
"@commitlint/config-conventional": "^20.0.0",
|
|
50
|
-
"@mikro-orm/
|
|
51
|
-
"@mikro-orm/
|
|
52
|
-
"@mikro-orm/
|
|
53
|
-
"@mikro-orm/
|
|
54
|
-
"@mikro-orm/
|
|
55
|
-
"@mikro-orm/
|
|
50
|
+
"@mikro-orm/core": "^7.0.1",
|
|
51
|
+
"@mikro-orm/mariadb": "^7.0.1",
|
|
52
|
+
"@mikro-orm/mssql": "^7.0.1",
|
|
53
|
+
"@mikro-orm/mysql": "^7.0.1",
|
|
54
|
+
"@mikro-orm/postgresql": "^7.0.1",
|
|
55
|
+
"@mikro-orm/sqlite": "^7.0.1",
|
|
56
56
|
"@tsconfig/node22": "^22.0.2",
|
|
57
57
|
"@types/node": "^24.9.1",
|
|
58
58
|
"c8": "^10.1.3",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@mikro-orm/core": "^
|
|
66
|
+
"@mikro-orm/core": "^7.0.1"
|
|
67
67
|
},
|
|
68
68
|
"packageManager": "pnpm@10.19.0+sha512.c9fc7236e92adf5c8af42fd5bf1612df99c2ceb62f27047032f4720b33f8eacdde311865e91c411f2774f618d82f320808ecb51718bfa82c060c4ba7c76a32b8",
|
|
69
69
|
"pnpm": {
|