@fivetrandevelopers/zetasql-snowflake
Version:
ZetaSQL Snowflake gRPC server and client
89 lines • 3.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeFactory = void 0;
const TypeKind_1 = require("./types/zetasql/TypeKind");
/**
* A factory for {@link Type} objects.
*
* A {@code TypeFactory} can be obtained via {@link #uniqueNames()} or {@link #nonUniqueNames()}
* static factory methods, depending if you want to guarantee uniqueness of descriptor full names
* for non-simple types or not, respectively.
*/
class TypeFactory {
}
exports.TypeFactory = TypeFactory;
TypeFactory.SIMPLE_TYPE_KIND_NAMES = new Map([
['int32', TypeKind_1.TypeKind.TYPE_INT32],
['int64', TypeKind_1.TypeKind.TYPE_INT64],
['uint32', TypeKind_1.TypeKind.TYPE_UINT32],
['uint64', TypeKind_1.TypeKind.TYPE_UINT64],
['bool', TypeKind_1.TypeKind.TYPE_BOOL],
['boolean', TypeKind_1.TypeKind.TYPE_BOOL],
['float32', TypeKind_1.TypeKind.TYPE_FLOAT],
['double', TypeKind_1.TypeKind.TYPE_DOUBLE],
['float', TypeKind_1.TypeKind.TYPE_DOUBLE],
['float64', TypeKind_1.TypeKind.TYPE_DOUBLE],
['string', TypeKind_1.TypeKind.TYPE_STRING],
['bytes', TypeKind_1.TypeKind.TYPE_BYTES],
['date', TypeKind_1.TypeKind.TYPE_DATE],
['timestamp', TypeKind_1.TypeKind.TYPE_TIMESTAMP],
['time', TypeKind_1.TypeKind.TYPE_TIME],
['datetime', TypeKind_1.TypeKind.TYPE_DATETIME],
['interval', TypeKind_1.TypeKind.TYPE_INTERVAL],
['geography', TypeKind_1.TypeKind.TYPE_GEOGRAPHY],
['bignumeric', TypeKind_1.TypeKind.TYPE_BIGNUMERIC],
['json', TypeKind_1.TypeKind.TYPE_JSON],
// Snowflake types
['number', TypeKind_1.TypeKind.TYPE_NUMERIC],
['decimal', TypeKind_1.TypeKind.TYPE_NUMERIC],
['numeric', TypeKind_1.TypeKind.TYPE_NUMERIC],
['int', TypeKind_1.TypeKind.TYPE_INT64],
['integer', TypeKind_1.TypeKind.TYPE_INT64],
['bigint', TypeKind_1.TypeKind.TYPE_INT64],
['smallint', TypeKind_1.TypeKind.TYPE_INT64],
['tinyint', TypeKind_1.TypeKind.TYPE_INT64],
['byteint', TypeKind_1.TypeKind.TYPE_INT64],
['float', TypeKind_1.TypeKind.TYPE_FLOAT],
['float4', TypeKind_1.TypeKind.TYPE_DOUBLE],
['float8', TypeKind_1.TypeKind.TYPE_DOUBLE],
['text', TypeKind_1.TypeKind.TYPE_STRING],
['timestamp_ntz', TypeKind_1.TypeKind.TYPE_TIMESTAMP],
['timestamp_tz', TypeKind_1.TypeKind.TYPE_TIMESTAMP],
['timestamp_ltz', TypeKind_1.TypeKind.TYPE_TIMESTAMP],
['binary', TypeKind_1.TypeKind.TYPE_BYTES],
['array', TypeKind_1.TypeKind.TYPE_ARRAY],
['variant', TypeKind_1.TypeKind.TYPE_VARIANT],
['object', TypeKind_1.TypeKind.TYPE_OBJECT],
['double precision', TypeKind_1.TypeKind.TYPE_DOUBLE],
['real', TypeKind_1.TypeKind.TYPE_DOUBLE], // external
]);
TypeFactory.EXTERNAL_MODE_SIMPLE_TYPE_KIND_NAMES = new Set([
'int64',
'bool',
'boolean',
'float64',
'string',
'bytes',
'date',
'timestamp',
'time',
'datetime',
'interval',
'geography',
'numeric',
'bignumeric',
'json',
'tokenlist',
// Snowflake types
'int',
'integer',
'bigint',
'smallint',
'tinyint',
'byteint',
'float4',
'float8',
'double precision',
'real',
]);
//# sourceMappingURL=TypeFactory.js.map