UNPKG

@bytebase/dbhub

Version:

Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite

17 lines (15 loc) • 505 B
// src/connectors/health-check-utils.ts function toNullableNumber(value) { return value === null || value === void 0 ? null : Number(value); } function computeHitRatioPct(logicalReads, physicalReads) { if (!Number.isFinite(logicalReads) || !Number.isFinite(physicalReads) || logicalReads === 0) { return null; } const pct = Math.round((logicalReads - physicalReads) / logicalReads * 1e4) / 100; return Math.min(100, Math.max(0, pct)); } export { toNullableNumber, computeHitRatioPct };