SQL name of the data type that is identified by its type OID and possibly a type modifier i.e. character varying(20), numeric(3,2), extra_modules."extra-domain"[], timestamp(0) without time zone etc.
If type is an array, this is the dimension of the array. Otherwise this is 0.
If typarray is not 0 then it identifies another row in pg_type, which is the array type having this type as element.
An arbitrary classification of PostgreSQL data types that is used by the PostgreSQL parser to determine which implicit casts should be “preferred”. See related doc here
All constraints of the constraint as an [[IndexableArray]] ordered by name.
Object identifier of PostgreSQL class (pg_catalog.pg_class
) for the Entity
Comment of the database object defined in database including {@link DbObject#commentData comment data}.
Default value without typecast. Default values includes single quotes except sql functions and numeric values.
Please note numeric values which may not be represented by JavaScript values are returned as strings. See here
const table = db('crm').schema('public').table('contact');
const defaultName = table.get("name").default; // "'George'"
const defaultNameWithCast = table.get("name").defaultWithTypeCast; // "'George'::character varying"
const defaultAge = table.get("age").default; // 20
const defaultStamp = table.get("created_at").default; // "now()"
Whether the type has length property.
Whether the type has precision property.
Whether the type has scale property.
Internal name of type. Available for some builtin types.
const name = doublePrecisionType.name; // double precision
const shortName = doublePrecisionType.internalName; // float8
If base type is a character type, then this is the length of the type.
Name of the database object.
true
if domain is not allowed to be null.
If type is a numeric type, its numerical type. If type is non-numeric this is undefined
.
For TypeScript it is an enum of NumericType.Integer
, NumericType.Exact
or NumericType.Floating
.
For JavaScript ir is a string of Integer
, Exact
or Floating
.
Object identifier for the Entity
undefined
.
For example: The number 23.5141 has a precision of 6 and a scale of 4.undefined
.
For example: The number 23.5141 has a precision of 6 and a scale of 4. Integers can be considered to have a scale of zero.Short name of type. Available for some builtin types.
const name = timetzType.name; // time with time zone
const shortName = timetzType.shortName; // time with time zone
const name2 = varcharType.name; // character varying
const shortName2 = varcharType.name; // varchar
Data which is extracted from database object's comment. Data is extracted from text between special case-insensitive tag
(default: [pg-structure][/pg-structure]
) and converted to JavaScript object using JSON5.
Token name can be specified by using commentDataToken
arguments.
For details of JSON5, see it's web site: https://json5.org.
// "Account details. [pg-structure]{ extraData: 2 }[/pg-structure] Also used for logging."
table.comment; // "Account details. [pg-structure]{ extraData: 2 }[/pg-structure] Also used for logging."
table.commentWithoutData; // "Account details. Also used for logging."
table.commentData; // { extraData: 2 }
table.commentData.extraData; // 2
Description or comment of the database object defined in database. If comment contains {@link DbObject#commentData comment data}, it is removed.
// "Account details. [pg-structure]{ extraData: 2 }[/pg-structure] Also used for logging."
table.commentWithoutData; // "Account details. Also used for logging."
Full name of the database object including database name.
Letter casing (i.e snakeCase
or camelCase
) of the database object name.
const name = entity.name; // ProductDetail
const caseType = entity.nameCaseType; // camelCase
const otherEntity = otherEntity.name; // member_protocol
const otherCaseType = otherEntity.nameCaseType; // snakeCase
Separator used in database object name. Empty string for came case and underscore for (_) snake case.
Data type of the domain.
Generated using TypeDoc
Class which represent a PostgreSQL domain. Provides attributes and methods for details of the domain.