If type is an array, this is the dimension of the array. Otherwise this is 0. NOTE: Array columns in views has dimension of 1 regardless of the actual dimension. Currently we could not find a way to determine array dimensions in views.
The number of the column. Ordinary columns are numbered from 1 up. Since dropped columns have an attribute number too, attribute number may be different from array index number.
Comment of the database object defined in database including {@link DbObject#commentData comment data}.
Default expression of the column with typecast. PostgreSQL returns default values with typecast. Default values includes single quotes except sql functions and numeric values. Also sql functions and numeric values do not contain type cast.
Numeric values are returned as string too. Please see: https://github.com/brianc/node-postgres/issues/1300
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()"
Length of the column.
undefined
for all other data types or if no maximum length was declared.Maximum value of the column (only for integer types).
Minimum value of the column (only for integer types).
Name of the database object.
true
if column is not allowed to be null.
Parent database object this column belongs to.
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.Data type of the column.
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."
Default value without typecast. Default values includes single quotes except sql functions and numeric values.
Numeric values are returned as string too. Please see: https://github.com/brianc/node-postgres/issues/1300
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()"
[[IndexableArray]] of foreign keys which column is part of.
Full name of the database object including database name.
Whether this column is part of a foreign key. Please note that a foreign key may contain more than one column and a column may part of more than one foreign key.
Whether column is part of a primary key. Please note that a primary key may contain more than one column.
Whether this column has nextval()
default value or one of serial
(auto incremented) types.
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
All referenced columns in all foreign keys by this column.
Separator used in database object name. Empty string for came case and underscore for (_) snake case.
[[IndexableArray]] of unique indexes, which column is part of. PostgreSQL already creates a unique index for unique constraints. So there is no need to look for unique constraints which will result duplicates.
[[IndexableArray]] of unique indexes, which column is part of. Excludes primary key indexes. PostgreSQL already creates a unique index for unique constraints. So there is no need to look for unique constraints which will result duplicates.
Generated using TypeDoc
Class which represent a column. Provides attributes and methods for details of the column.