0

I was going through this code and I noticed this

 sqlToNangoTypeMapping(sqlType: string) {
        switch (sqlType) {
            case 'integer':
                return NangoColumnDataTypes.NUMBER;
            case 'real':
                return NangoColumnDataTypes.NUMBER;
            case 'timestamp with time zone':
                return NangoColumnDataTypes.DATE;
            case 'character varying':
            case 'text':
                return NangoColumnDataTypes.STRING;
            case 'json':
                return NangoColumnDataTypes.JSON;
            case 'boolean':
                return NangoColumnDataTypes.BOOLEAN;
            default:
                logger.error(`Unkwown Postgres column type returned from schema: ${sqlType}`);
                return NangoColumnDataTypes.UNKNOWN;
        }
    }

What does this do?

            case 'character varying':
            case 'text':
                return NangoColumnDataTypes.STRING;

Is it like if case is text or character varying then return NangoColumnDataTypes.STRING;?

Alwaysblue
  • 9,948
  • 38
  • 121
  • 210
  • The reason you need `break;` or `return;` in a `switch` is because otherwise the code just continues executing. – VLAZ Dec 02 '22 at 12:47

0 Answers0