mirror of
https://github.com/strapi/strapi.git
synced 2025-07-20 07:27:06 +00:00
38 lines
520 B
JavaScript
38 lines
520 B
JavaScript
'use strict';
|
|
|
|
// simple example
|
|
const dialects = {
|
|
pg: {
|
|
fields: {
|
|
string: 'varchar',
|
|
},
|
|
},
|
|
sqlite: {
|
|
fields: {
|
|
string: 'text',
|
|
},
|
|
},
|
|
};
|
|
|
|
const FIELDS = {
|
|
string: {
|
|
defaultColumnType: 'varchar',
|
|
// before write
|
|
parser: a => a,
|
|
// after read
|
|
formatter: a => a,
|
|
// before write
|
|
validator: a => a,
|
|
},
|
|
};
|
|
|
|
module.exports = {
|
|
get(type) {
|
|
if (!(type in FIELDS)) {
|
|
throw new Error(`Unknow field ${type}`);
|
|
}
|
|
|
|
return FIELDS[type];
|
|
},
|
|
};
|