@clickup/pg-microsharding
Version:
Microshards support for PostgreSQL
11 lines (9 loc) • 296 B
text/typescript
import { sql } from "./quote";
import { runSql } from "./runSql";
/**
* Checks whether the given DSN is a master database.
*/
export async function isMasterDsn(dsn: string): Promise<boolean> {
const result = await runSql.one(dsn, sql`SELECT pg_is_in_recovery()`);
return result === "f";
}