@fewer/adapter-postgres
Version:
A Fewer database adapter to connect to Postgres
47 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const fewer_1 = require("fewer");
function columnType(name, reflectName) {
return function (config) {
return new fewer_1.ColumnType(name, config, reflectName || name);
};
}
const columnTypes = {
// Boolean Type:
boolean: columnType('boolean'),
// Numeric Types:
numeric: columnType('numeric'),
decimal: columnType('decimal'),
smallint: columnType('smallint'),
integer: columnType('integer'),
int: columnType('int'),
bigint: columnType('bigint'),
double: columnType('double precision', 'double'),
real: columnType('real'),
// Numeric Serial Types (automatiocally non null):
smallserial: (options) => new fewer_1.ColumnType('smallserial', options),
serial: (options) => new fewer_1.ColumnType('serial', options),
bigserial: (options) => new fewer_1.ColumnType('bigserial', options),
// Character Types:
char: columnType('char'),
varchar: columnType('varchar'),
text: columnType('text'),
string: (options) => columnTypes.varchar(Object.assign({ length: 255 }, options)),
// Binary Data Types:
bytea: columnType('bytea'),
// Geometric Types:
point: columnType('point'),
line: columnType('line'),
lseg: columnType('lseg'),
box: columnType('box'),
path: columnType('path'),
polygon: columnType('polygon'),
circle: columnType('circle'),
// UUID Type:
uuid: columnType('uuid'),
// JSON Types:
json: columnType('json'),
jsonb: columnType('jsonb'),
};
exports.default = columnTypes;
//# sourceMappingURL=columnTypes.js.map