Skip to main content
Version: Next

BlobType

Hierarchy

Index

Constructors

constructor

  • Returns BlobType

Properties

optionalinheritedmeta

meta?: EntityMetadata<any>

optionalinheritedplatform

platform?: Platform

optionalinheritedprop

prop?: EntityProperty<any, any>

Accessors

inheritedname

  • get name(): string
  • Returns string

inheritedruntimeType

  • get runtimeType(): string
  • Returns string

Methods

compareAsType

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


    Returns string

optionalinheritedcompareValues

  • compareValues(a: null | Uint8Array<ArrayBufferLike>, b: null | Uint8Array<ArrayBufferLike>): boolean
  • Allows to override the internal comparison logic.


    Parameters

    • a: null | Uint8Array<ArrayBufferLike>
    • b: null | Uint8Array<ArrayBufferLike>

    Returns boolean

inheritedconvertToDatabaseValue

  • convertToDatabaseValue(value: Uint8Array<ArrayBufferLike>): Buffer<ArrayBufferLike>
  • Converts a value from its JS representation to its database representation of this type.


    Parameters

    • value: Uint8Array<ArrayBufferLike>

    Returns Buffer<ArrayBufferLike>

optionalinheritedconvertToDatabaseValueSQL

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


    Parameters

    Returns string

convertToJSValue

  • convertToJSValue(value: Buffer<ArrayBufferLike>): null | Buffer<ArrayBufferLike>
  • Converts a value from its database representation to its JS representation of this type.


    Parameters

    • value: Buffer<ArrayBufferLike>

    Returns null | Buffer<ArrayBufferLike>

optionalinheritedconvertToJSValueSQL

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


    Parameters

    Returns string

ensureComparable

  • ensureComparable(): 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.


    Returns boolean

getColumnType

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


    Parameters

    Returns string

optionalinheritedgetDefaultLength

  • getDefaultLength(platform: Platform): number
  • 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

    • platform: Platform

      The platform the default will be used for.

    Returns number

    The default value for the given platform.

inheritedtoJSON

  • toJSON(value: null | Uint8Array<ArrayBufferLike>, platform: Platform): null | Uint8Array<ArrayBufferLike>
  • Converts a value from its JS representation to its serialized JSON form of this type. By default uses the runtime value.


    Parameters

    • value: null | Uint8Array<ArrayBufferLike>
    • platform: Platform

    Returns null | Uint8Array<ArrayBufferLike>

staticinheritedgetType

  • getType(cls: TypeClass): InstanceType<TypeClass>
  • Parameters

    • cls: TypeClass

    Returns InstanceType<TypeClass>

staticinheritedisMappedType

  • 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>