mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-21 21:01:55 +08:00
13 lines
537 B
TypeScript
13 lines
537 B
TypeScript
import { quoteQualifiedIdent } from './sql';
|
|
|
|
export const buildTableSelectQuery = (dbType: string, tableName: string): string => {
|
|
const normalizedTableName = String(tableName || '').trim();
|
|
if (!normalizedTableName) {
|
|
return 'SELECT * FROM ';
|
|
}
|
|
if (['rocketmq', 'mqtt', 'kafka', 'rabbitmq'].includes(String(dbType || '').trim().toLowerCase())) {
|
|
return `SELECT * FROM ${quoteQualifiedIdent(dbType, normalizedTableName)} LIMIT 100;`;
|
|
}
|
|
return `SELECT * FROM ${quoteQualifiedIdent(dbType, normalizedTableName)};`;
|
|
};
|