Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DataType

DataType is an 'Enum' containing all of the supported data types.

dynamic

Hierarchy

Index

Constructors

constructor

  • new DataType(propertiesObj?: Object): DataType

Properties

_$typeName

_$typeName: string

Type of the enum; set in prototype of each enum

Optional defaultValue

defaultValue: any

The default value of this DataType. Read Only

Optional isInteger

isInteger: boolean

Whether this is an 'integer' DataType. Read Only

Optional isNumeric

isNumeric: boolean

Whether this is a 'numeric' DataType. Read Only

name

name: string

The name of this symbol

Optional quoteJsonOData

quoteJsonOData: boolean

Whether to quote the json value when formatting this DataType for OData.

Static Binary

Binary: DataType = new DataType({defaultValue: null,fmtOData: fmtBinary,parseRawValue: parseRawBinary})

Static Boolean

Boolean: DataType = new DataType({defaultValue: false,parse: coerceToBool,fmtOData: fmtBoolean})

Static Byte

Byte: DataType = new DataType({defaultValue: 0,isNumeric: true,isInteger: true,parse: coerceToInt,fmtOData: fmtInt})

Static DateTime

DateTime: DataType = new DataType({defaultValue: new Date(1900, 0, 1),isDate: true,parse: coerceToDate,parseRawValue: parseRawDate,normalize: function (value: any) { return value && value.getTime && value.getTime(); }, // dates don't perform equality comparisons properlyfmtOData: fmtDateTime,getNext: getNextDateTime,getConcurrencyValue: getConcurrencyDateTime})

Static DateTimeOffset

DateTimeOffset: DataType = new DataType({defaultValue: new Date(1900, 0, 1),isDate: true,parse: coerceToDate,parseRawValue: parseRawDate,normalize: function (value: any) { return value && value.getTime && value.getTime(); }, // dates don't perform equality comparisons properlyfmtOData: fmtDateTimeOffset,getNext: getNextDateTime,getConcurrencyValue: getConcurrencyDateTime})

Static Decimal

Decimal: DataType = new DataType({defaultValue: 0,isNumeric: true,quoteJsonOData: true,isFloat: true,parse: coerceToFloat,fmtOData: makeFloatFmt("m"),getNext: getNextNumber})

Static Double

Double: DataType = new DataType({defaultValue: 0,isNumeric: true,isFloat: true,parse: coerceToFloat,fmtOData: makeFloatFmt("d"),getNext: getNextNumber})

Static Guid

Guid: DataType = new DataType({defaultValue: "00000000-0000-0000-0000-000000000000",parse: coerceToGuid,fmtOData: fmtGuid,getNext: getNextGuid,parseRawValue: function (val: string) { return val.toLowerCase(); },getConcurrencyValue: core.getUuid})

Static Int16

Int16: DataType = new DataType({defaultValue: 0,isNumeric: true,isInteger: true,parse: coerceToInt,fmtOData: fmtInt,getNext: getNextNumber})

Static Int32

Int32: DataType = new DataType({defaultValue: 0,isNumeric: true,isInteger: true,parse: coerceToInt,fmtOData: fmtInt,getNext: getNextNumber})

Static Int64

Int64: DataType = new DataType({defaultValue: 0,isNumeric: true,isInteger: true,quoteJsonOData: true,parse: coerceToInt,fmtOData: makeFloatFmt("L"),getNext: getNextNumber})

Static Single

Single: DataType = new DataType({defaultValue: 0,isNumeric: true,isFloat: true,parse: coerceToFloat,fmtOData: makeFloatFmt("f"),getNext: getNextNumber})

Static String

String: DataType = new DataType({defaultValue: "",parse: coerceToString,fmtOData: fmtString,getNext: getNextString})

Static Time

Time: DataType = new DataType({defaultValue: "PT0S",fmtOData: fmtTime,parseRawValue: DataType.parseTimeFromServer})

Static Undefined

Undefined: DataType = new DataType({defaultValue: undefined,fmtOData: fmtUndefined})

Methods

Optional fmtOData

  • fmtOData(value: any): any
  • Optional function to format this DataType for OData queries.

    Parameters

    • value: any

    Returns any

    value appropriate for OData query

Optional getConcurrencyValue

  • getConcurrencyValue(previousValue?: any): any
  • Optional function to get the next value when the datatype is used as a concurrency property.

    Parameters

    • Optional previousValue: any

    Returns any

    the next concurrency value, which may be a function of the previousValue.

Optional getNext

  • getNext(): any
  • Optional function to get the next value for key generation, if this datatype is used as a key. Uses an internal table of previous values.

    Returns any

    value appropriate for this DataType

Optional normalize

  • normalize(value: any): any
  • Optional function to normalize a data value for comparison, if its value cannot be used directly. Note that this will be called each time a property is changed, so make it fast.

    Parameters

    • value: any

    Returns any

    value appropriate for this DataType

Optional parse

  • parse(source: any, sourceTypeName: string): any
  • Optional function to convert a value from string to this DataType. Note that this will be called each time a property is changed, so make it fast.

    Parameters

    • source: any
    • sourceTypeName: string

    Returns any

    value appropriate for this DataType

Optional parseRawValue

  • parseRawValue(value: any): any
  • Optional function to convert a raw (server) value from string to this DataType.

    Parameters

    • value: any

    Returns any

    value appropriate for this DataType

toJSON

  • toJSON(): object

toString

  • toString(): string

Optional validatorCtor

  • The constructor function to create a Validator to be used in validating instances of this DataType.

    Parameters

    • Optional context: any

    Returns Validator

Static contains

  • Returns whether an Enum contains a specified symbol.

    let symbol = DayOfWeek.Friday;
    if (DayOfWeek.contains(symbol)) {
        // do something
    }

    Parameters

    Returns boolean

    Whether this Enum contains the specified symbol.

Static fromEdmDataType

  • fromEdmDataType(typeName: string): DataType
  • Returns the DataType for a specified EDM type name.

    Parameters

    • typeName: string

    Returns DataType

Static fromName

  • fromName(name: string): any
  • Returns an Enum symbol given its name.

    let dayOfWeek = DayOfWeek.from("Thursday");
    // nowdayOfWeek === DayOfWeek.Thursday

    Parameters

    • name: string

      Name for which an enum symbol should be returned.

    Returns any

    The symbol that matches the name or 'undefined' if not found.

Static fromValue

Static getComparableFn

Static getNames

  • getNames(): string[]
  • Returns the names of all of the symbols contained within this Enum.

    let symbols = DayOfWeek.getNames();

    Returns string[]

    All of the names of the symbols contained within this Enum.

Static getSymbols

  • Returns all of the symbols contained within this Enum.

    let symbols = DayOfWeek.getSymbols();

    Returns BreezeEnum[]

    All of the symbols contained within this Enum.

Static parseDateAsUTC

  • parseDateAsUTC(source: any): any

Static parseDateFromServer

  • parseDateFromServer(value: any): any

Static parseRawValue

  • parseRawValue(val: any, dataType?: DataType): any
  • Returns a raw value converted to the specified DataType

    Parameters

    Returns any

Static parseTimeFromServer

  • parseTimeFromServer(source: any): any

Static resolveSymbols

  • resolveSymbols(): object[]
  • Seals this enum so that no more symbols may be added to it. This should only be called after all symbols have already been added to the Enum. This method also sets the 'name' property on each of the symbols.

    DayOfWeek.resolveSymbols();

    Returns object[]

Generated using TypeDoc