Skip to main content
Version: 5.9

ArrayType <T>

Hierarchy

  • Type<T[] | null, string | null>
    • ArrayType
      • EnumArrayType

Index

Constructors

constructor

  • new ArrayType<T>(hydrate?: (i: string) => T): ArrayType<T>
  • Type parameters

    • T: string | number = string

    Parameters

    • hydrate: (i: string) => T = ...

      Returns ArrayType<T>

    Properties

    optionalmeta

    meta?: EntityMetadata<any>

    optionalplatform

    platform?: Platform

    optionalprop

    prop?: EntityProperty<any>

    Methods

    [custom]

    • [custom](depth: number): string
    • Parameters

      • depth: number

      Returns string

    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

    convertToDatabaseValue

    • convertToDatabaseValue(value: null | T[], platform: Platform, context?: boolean | TransformContext): null | string
    • Converts a value from its JS representation to its database representation of this type.


      Parameters

      • value: null | T[]
      • platform: Platform
      • optionalcontext: boolean | TransformContext

      Returns null | string

    optionalconvertToDatabaseValueSQL

    • convertToDatabaseValueSQL(key: string, platform: Platform): string
    • Converts a value from its JS representation to its database representation of this type.


      Parameters

      • key: string
      • platform: Platform

      Returns string

    convertToJSValue

    • convertToJSValue(value: null | string | T[], platform: Platform): null | T[]
    • Converts a value from its database representation to its JS representation of this type.


      Parameters

      • value: null | string | T[]
      • platform: Platform

      Returns null | T[]

    optionalconvertToJSValueSQL

    • convertToJSValueSQL(key: string, platform: Platform): string
    • Modifies the SQL expression (identifier, parameter) to convert to a JS value.


      Parameters

      • key: string
      • platform: Platform

      Returns string

    ensureComparable

    • ensureComparable<T>(meta: EntityMetadata<T>, prop: EntityProperty<T>): boolean
    • 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

      • T: object

      Parameters

      • meta: EntityMetadata<T>
      • prop: EntityProperty<T>

      Returns boolean

    getColumnType

    • getColumnType(prop: EntityProperty<any>, platform: Platform): string
    • Gets the SQL declaration snippet for a field of this type.


      Parameters

      • prop: EntityProperty<any>
      • platform: Platform

      Returns string

    toJSON

    • toJSON(value: T[]): T[]
    • Converts a value from its JS representation to its serialized JSON form of this type. By default uses the runtime value.


      Parameters

      • value: T[]

      Returns T[]

    staticgetType

    • getType<JSType, DBType>(cls: Constructor<Type<JSType, DBType>>): Type<JSType, DBType>
    • Type parameters

      • JSType
      • DBType = JSType

      Parameters

      • cls: Constructor<Type<JSType, DBType>>

      Returns Type<JSType, DBType>

    staticisCustomType

    • isCustomType(data: any): data is Type<any, any>
    • Checks whether the argument is instance of custom Type class provided by the user.


      Parameters

      • data: any

      Returns data is Type<any, any>

    staticisMappedType

    • isMappedType(data: any): data is Type<any, any>
    • Checks whether the argument is instance of Type.


      Parameters

      • data: any

      Returns data is Type<any, any>