@clickup/pg-microsharding
Version:
Microshards support for PostgreSQL
18 lines (16 loc) • 379 B
text/typescript
import { libSchema } from "./names";
import { sql } from "./quote";
import { runSql } from "./runSql";
/**
* Returns the list of active shards on a DSN.
*/
export async function listActiveSchemas({
dsn,
}: {
dsn: string;
}): Promise<string[]> {
return runSql.column(
dsn,
sql`SELECT unnest FROM unnest(${libSchema()}.microsharding_list_active_shards())`,
);
}