Add csv special type, return type based on special flag

This commit is contained in:
rijkvanzanten
2020-09-10 14:14:24 -04:00
parent ff02879a67
commit 68e05a208a
4 changed files with 25 additions and 3 deletions

View File

@@ -78,9 +78,21 @@ const localTypeMap: Record<string, { type: typeof types[number]; useTimezone?: b
float8: { type: 'float' },
};
export default function getLocalType(databaseType: string): typeof types[number] | 'unknown' {
export default function getLocalType(
databaseType: string,
special?: string | null
): typeof types[number] | 'unknown' {
const type = localTypeMap[databaseType.toLowerCase().split('(')[0]];
switch (special) {
case 'json':
return 'json';
case 'csv':
return 'csv';
case 'uuid':
return 'uuid';
}
if (type) {
return type.type;
}