src/model/types/BasicColumn.ts
Containes the necessary information to display an object as a column in the schema graph
Properties |
dataType |
dataType:
|
Type : string
|
dataTypeString |
dataTypeString:
|
Type : string
|
name |
name:
|
Type : string
|
nullable |
nullable:
|
Type : boolean
|
export default interface BasicColumn {
name: string;
dataType: string;
nullable: boolean;
dataTypeString: string;
}
export function surrogateKeyColumn(name: string): BasicColumn {
return {
name: name,
dataType: 'integer',
nullable: false,
dataTypeString: '(integer, not null)',
};
}
export function newBasicColumn(
name: string,
dataType: string,
nullable: boolean
): BasicColumn {
return {
name: name,
dataType: dataType,
nullable: nullable,
dataTypeString: `(${dataType}, ${nullable ? 'null' : 'not null'})`,
};
}