Version: 4.3

Class: Type<JSType, DBType>

Type parameters

NameDefault
JSTypestring
DBTypeJSType

Hierarchy

Properties

types

Static Private Readonly types: Map<any, any> = new Map()

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

Methods

compareAsType

compareAsType(): string

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

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

Returns: string


convertToDatabaseValue

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

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

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

Parameters:

NameType
valueJSType | DBType
platformPlatform
fromQuery?boolean

Returns: DBType


convertToJSValue

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

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

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

Parameters:

NameType
valueJSType | DBType
platformPlatform

Returns: JSType


getColumnType

getColumnType(prop: EntityProperty, platform: Platform): string

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

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

Parameters:

NameType
propEntityProperty
platformPlatform

Returns: string


toJSON

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

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

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


getType

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

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

Type parameters:

Name
JSType
DBType

Parameters:

NameType
clsConstructor<Type<JSType, DBType>>

Returns: Type<JSType, DBType>

Last updated on by Martin Adámek