@oliveward-common/mikroorm-common
v0.0.13
Published
Reusable MikroORM custom types built on `@oliveward-common/data-common`.
Readme
@oliveward-common/mikroorm-common
Reusable MikroORM custom types built on @oliveward-common/data-common.
Install
npm install @oliveward-common/mikroorm-commonUsage
import { EntitySchema } from '@mikro-orm/core'
import { EmailType, InstantType, UuidType } from '@oliveward-common/mikroorm-common'
interface User {
id: string
email: string
createdAt: Temporal.Instant
}
export const UserSchema = new EntitySchema<User>({
name: 'User',
properties: {
id: { type: UuidType, primary: true },
email: { type: EmailType },
createdAt: { type: InstantType },
},
})PlainDateTimeType, Ipv4Type, and Ipv6Type default to portable text columns. Use columnType/columnTypes when you want a database-specific declaration such as PostgreSQL timestamp or inet.
Public API
This package exports the following API surface from src/index.ts:
export {
BinaryType,
BooleanType,
DurationType,
EmailType,
FloatType,
InstantType,
Int32Type,
Int64Type,
Ipv4Type,
Ipv6Type,
PlainDateType,
PlainDateTimeType,
PlainTimeType,
StringType,
UrlType,
UuidType,
ZonedDateTimeType,
} from './types.js'Development
npm run build -w @oliveward-common/mikroorm-common
npm run test -w @oliveward-common/mikroorm-common