Skip to main content

mapScalar

@webda/sql-schema


Function: mapScalar()

mapScalar(schema, reflectedType, options): ScalarMapping

Defined in: packages/sql-schema/src/columns.ts:40

Map a JSON schema property to a column type

string is text (varchar(n) with maxLength, timestamptz/date/uuid by format), integer is bigint, number is double (decimal with numericAsDecimal), boolean is boolean, everything else (objects, arrays, unions, references, untyped) is json.

Parameters​

schema​

JSONSchemaLike | undefined

the property schema

reflectedType​

string | undefined

the TypeScript type of the field, from Reflection (a Date without format is a timestamp)

options​

Pick<SchemaLayoutOptions, "numericAsDecimal">

the layout options

Returns​

ScalarMapping

the mapping