Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -352,49 +352,71 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements
return [];
}
private cassandraTypeToReadable(type: any): string {
if (typeof type === 'string') return type;
if (typeof type === 'string') {
return this.stripGenerics(type);
}

if (type && typeof type === 'object') {
if (type.info && type.info.name) return type.info.name;
if (type.info && type.info.name) {
return this.stripGenerics(type.info.name);
}

if (type.code !== undefined) {
switch (type.code) {
case 0:
return 'custom';
case 1:
return 'ascii';
case 2:
return 'bigint';
case 3:
return 'blob';
case 4:
return 'int';
return 'boolean';
case 5:
return 'bigint';
return 'counter';
case 6:
return 'varint';
case 7:
return 'decimal';
case 7:
return 'double';
case 8:
return 'boolean';
case 9:
return 'float';
case 9:
return 'int';
case 10:
return 'double';
case 12:
return 'text';
case 11:
return 'timestamp';
case 12:
return 'uuid';
case 13:
return 'varchar';
case 14:
return 'varint';
case 15:
return 'timeuuid';
case 16:
return 'uuid';
return 'inet';
case 17:
return 'timeuuid';
return 'date';
case 18:
return 'time';
case 19:
return 'timestamp';
return 'smallint';
case 20:
return 'inet';
return 'tinyint';
case 21:
return 'date';
case 22:
return 'time';
return 'duration';
case 32:
return 'list';
case 33:
return 'map';
case 34:
return 'set';
case 0:
return 'custom';
case 48:
return 'udt';
case 49:
return 'tuple';
default:
return `type_code_${type.code}`;
}
Expand All @@ -403,6 +425,13 @@ export class DataAccessObjectCassandra extends BasicDataAccessObject implements
return 'unknown';
}

private stripGenerics(typeName: string): string {
if (typeName.includes('<')) {
return typeName.substring(0, typeName.indexOf('<'));
}
return typeName;
}

public async getTablePrimaryColumns(tableName: string): Promise<Array<PrimaryKeyDS>> {
try {
const client = await this.getCassandraClient();
Expand Down
Loading