DbColumn - do-/node-doix-db GitHub Wiki

DbColumn is an object describing a column of a relation in a database.

Properties

Name Type Description
relation DbRelation Table, view etc. which this column belongs to
name String Logical name (identifier) of this column
qName String Quoted name of this column, good for SQL (DDL etc.)
comment String Comment for this column
reference DbReference (if present)
type String Name of the data type
typeDef DbType The result of DbLang's getTypeDefinition ()
typeDim String ${type}[(${size}[,${scale}])]
size int Maximum size of the data (length for VARCHAR, precision for DECIMAL etc.). The exact meaning (units etc.) and the mere existence meaning depends of the type.
scale int For DECIMAL, his synonyms and/or derived types, (NUMERIC etc.) means the length of the fractional part. Must be absent for other types.
default String If non-null, this string is to be interpolated into the DEFAULT clause of the corresponding CREATE/ALTER TABLE statement.
nullable Boolean false for NOT NULL columns, true otherwise.
min String The minimal allowed value. Corresponds to the HTML INPUT's min attribute. May be used in CHECK constraints, forwarded to UI components etc.
max String The maximal allowed value. Corresponds to the HTML INPUT's max attribute. May be used in CHECK constraints, forwarded to UI components etc.
pattern String The regular expression to test values against. Corresponds to the HTML INPUT's pattern attribute. May be used in CHECK constraints, forwarded to UI components etc.

Constructor

The 1st parameter is a bag of options, e. g. parsed from the Column Definition Language

const options = new Lang ().parseColumn ('int=0')
// {type: 'int', comment: 'ID', default: '0', nullable: false}

const ref = new DbColumn (options)