mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Add csv special type, return type based on special flag
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user