UnixTimestampType
Defined in: packages/ddd-mikro-orm/src/mapping/unix-timestamp.type.ts:47
MikroORM type that stores a Date as epoch milliseconds in a 64-bit bigint
column.
null and undefined pass through in both directions. A value that has no
valid time throws a TypeError rather than being stored or returned as
NaN.
Extends
Section titled “Extends”Type<Date|null|undefined,number|null|undefined>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new UnixTimestampType():
UnixTimestampType
Returns
Section titled “Returns”UnixTimestampType
Inherited from
Section titled “Inherited from”Type< Date | null | undefined, number | null | undefined >.constructor
Properties
Section titled “Properties”
optionalmeta?:EntityMetadata<any,EntityCtor<any>>
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:22
Inherited from
Section titled “Inherited from”Type.meta
platform?
Section titled “platform?”
optionalplatform?:Platform
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:21
Inherited from
Section titled “Inherited from”Type.platform
optionalprop?:EntityProperty<any,any>
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:23
Inherited from
Section titled “Inherited from”Type.prop
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get name():
string
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:50
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Type.name
runtimeType
Section titled “runtimeType”Get Signature
Section titled “Get Signature”get runtimeType():
string
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:49
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Type.runtimeType
Methods
Section titled “Methods”compareAsType()
Section titled “compareAsType()”compareAsType():
string
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:44
How should the raw database values be compared? Used in EntityComparator.
Possible values: string | number | bigint | boolean | date | any | buffer | array
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Type.compareAsType
compareValues()?
Section titled “compareValues()?”
optionalcompareValues(a,b):boolean
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:48
Allows to override the internal comparison logic.
Parameters
Section titled “Parameters”number | null | undefined
number | null | undefined
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Type.compareValues
convertToDatabaseValue()
Section titled “convertToDatabaseValue()”convertToDatabaseValue(
value,_platform?,_context?):number|null|undefined
Defined in: packages/ddd-mikro-orm/src/mapping/unix-timestamp.type.ts:51
Converts a value from its JS representation to its database representation of this type.
Parameters
Section titled “Parameters”Timestamp | null | undefined
_platform?
Section titled “_platform?”Platform
_context?
Section titled “_context?”TransformContext
Returns
Section titled “Returns”number | null | undefined
Overrides
Section titled “Overrides”Type.convertToDatabaseValue
convertToDatabaseValueSQL()?
Section titled “convertToDatabaseValueSQL()?”
optionalconvertToDatabaseValueSQL(key,platform):string
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:35
Converts a value from its JS representation to its database representation of this type.
Parameters
Section titled “Parameters”string
platform
Section titled “platform”Platform
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Type.convertToDatabaseValueSQL
convertToJSValue()
Section titled “convertToJSValue()”convertToJSValue(
value,_platform?,_context?):Date|null|undefined
Defined in: packages/ddd-mikro-orm/src/mapping/unix-timestamp.type.ts:60
Converts a value from its database representation to its JS representation of this type.
Parameters
Section titled “Parameters”Timestamp | null | undefined
_platform?
Section titled “_platform?”Platform
_context?
Section titled “_context?”TransformContext
Returns
Section titled “Returns”Date | null | undefined
Overrides
Section titled “Overrides”Type.convertToJSValue
convertToJSValueSQL()?
Section titled “convertToJSValueSQL()?”
optionalconvertToJSValueSQL(key,platform):string
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:39
Modifies the SQL expression (identifier, parameter) to convert to a JS value.
Parameters
Section titled “Parameters”string
platform
Section titled “platform”Platform
Returns
Section titled “Returns”string
Inherited from
Section titled “Inherited from”Type.convertToJSValueSQL
ensureComparable()
Section titled “ensureComparable()”ensureComparable<
T>(meta,prop):boolean
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:56
When a value is hydrated, we convert it back to the database value to ensure comparability,
as often the raw database response is not the same as the convertToDatabaseValue result.
This allows to disable the additional conversion in case you know it is not needed.
Type Parameters
Section titled “Type Parameters”T extends object
Parameters
Section titled “Parameters”EntityMetadata<T>
EntityProperty<T>
Returns
Section titled “Returns”boolean
Inherited from
Section titled “Inherited from”Type.ensureComparable
fromJSON()?
Section titled “fromJSON()?”
optionalfromJSON(value,platform):Date|null|undefined
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:72
Converts a value from its serialized JSON form back to its JS representation. Used when
decoding cursor values. The input is what toJSON produced, after a JSON.parse round
trip, and never an already restored JS value. Cursors are client supplied, so the value
can be any JSON shape: validate it and throw for values the type cannot restore, and
findByCursor surfaces the failure as a CursorError.
Implementing this method also makes cursor encoding use toJSON. Without it, cursors
carry the raw JS value, and decoding falls back to convertToJSValue, with type-based
Date restoration for date-like columns.
Parameters
Section titled “Parameters”unknown
platform
Section titled “platform”Platform
Returns
Section titled “Returns”Date | null | undefined
Inherited from
Section titled “Inherited from”Type.fromJSON
getColumnType()
Section titled “getColumnType()”getColumnType(
prop?,platform?):string
Defined in: packages/ddd-mikro-orm/src/mapping/unix-timestamp.type.ts:70
Gets the SQL declaration snippet for a field of this type.
Parameters
Section titled “Parameters”EntityProperty = ...
platform?
Section titled “platform?”Platform
Returns
Section titled “Returns”string
Overrides
Section titled “Overrides”Type.getColumnType
getDefaultLength()?
Section titled “getDefaultLength()?”
optionalgetDefaultLength(platform):number
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:91
Get the default length for values of this type
When doing schema generation, if neither “length” nor “columnType” option is provided, the length will be defaulted to this value.
When doing entity generation, if the type is recognized to this type, and the inferred length is this value, the length option will be omitted in the output. If this method is not defined, length is always outputted based on what is in the database metadata.
Parameters
Section titled “Parameters”platform
Section titled “platform”Platform
The platform the default will be used for.
Returns
Section titled “Returns”number
The default value for the given platform.
Inherited from
Section titled “Inherited from”Type.getDefaultLength
toJSON()
Section titled “toJSON()”toJSON(
value,platform):number|Date|null|undefined
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:61
Converts a value from its JS representation to its serialized JSON form of this type. By default uses the runtime value.
Parameters
Section titled “Parameters”Date | null | undefined
platform
Section titled “platform”Platform
Returns
Section titled “Returns”number | Date | null | undefined
Inherited from
Section titled “Inherited from”Type.toJSON
getOrmType()
Section titled “getOrmType()”
staticgetOrmType(cls):string|undefined
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:102
Internal
Returns the built-in type registry key if the given constructor is a branded ORM type
(not a user subclass). Uses Symbol.for() so it works across CJS/ESM module graphs.
Parameters
Section titled “Parameters”object
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”Type.getOrmType
getType()
Section titled “getType()”
staticgetType<JSType,DBType,TypeClass>(cls):InstanceType<TypeClass>
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:92
Type Parameters
Section titled “Type Parameters”JSType
Section titled “JSType”JSType
DBType
Section titled “DBType”DBType = JSType
TypeClass
Section titled “TypeClass”TypeClass extends Constructor<Type<JSType, DBType>> = Constructor<Type<JSType, DBType>>
Parameters
Section titled “Parameters”TypeClass
Returns
Section titled “Returns”InstanceType<TypeClass>
Inherited from
Section titled “Inherited from”Type.getType
isMappedType()
Section titled “isMappedType()”
staticisMappedType(data):data is Type<any, any>
Defined in: node_modules/.pnpm/@mikro-orm+core@7.2.1/node_modules/@mikro-orm/core/types/Type.d.ts:96
Checks whether the argument is instance of Type.
Parameters
Section titled “Parameters”any
Returns
Section titled “Returns”data is Type<any, any>
Inherited from
Section titled “Inherited from”Type.isMappedType