Skip to main content
Version: 4.4

Class: Type<JSType, DBType>#

core.Type

Type parameters#

NameDefault
JSTypestring
DBTypeJSType

Hierarchy#

Constructors#

constructor#

+ new Type<JSType, DBType>(): Type<JSType, DBType>

Type parameters:#

NameDefault
JSTypestring
DBTypeJSType

Returns: Type<JSType, DBType>

Properties#

types#

Private Readonly Static types: Map<any, any>

Defined in: packages/core/src/types/Type.ts:6

Methods#

compareAsType#

compareAsType(): string

How should the raw database values be compared? Used in EntityComparator. Possible values: string | number | boolean | date | any | buffer | array

Returns: string

Defined in: packages/core/src/types/Type.ts:26


convertToDatabaseValue#

convertToDatabaseValue(value: JSType | DBType, platform: Platform, fromQuery?: boolean): DBType

Converts a value from its JS representation to its database representation of this type.

Parameters:#

NameType
valueJSType | DBType
platformPlatform
fromQuery?boolean

Returns: DBType

Defined in: packages/core/src/types/Type.ts:11


convertToJSValue#

convertToJSValue(value: JSType | DBType, platform: Platform): JSType

Converts a value from its database representation to its JS representation of this type.

Parameters:#

NameType
valueJSType | DBType
platformPlatform

Returns: JSType

Defined in: packages/core/src/types/Type.ts:18


getColumnType#

getColumnType(prop: EntityProperty<any>, platform: Platform): string

Gets the SQL declaration snippet for a field of this type.

Parameters:#

NameType
propEntityProperty<any>
platformPlatform

Returns: string

Defined in: packages/core/src/types/Type.ts:41


toJSON#

toJSON(value: JSType, platform: Platform): JSType | DBType

Converts a value from its JS representation to its serialized JSON form of this type. By default uses the runtime value.

Parameters:#

NameType
valueJSType
platformPlatform

Returns: JSType | DBType

Defined in: packages/core/src/types/Type.ts:34


getType#

StaticgetType<JSType, DBType>(cls: Constructor<Type<JSType, DBType>>): Type<JSType, DBType>

Type parameters:#

Name
JSType
DBType

Parameters:#

NameType
clsConstructor<Type<JSType, DBType>>

Returns: Type<JSType, DBType>

Defined in: packages/core/src/types/Type.ts:46

Last updated on by Martin Adámek