MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / checkConnection

Function checkConnection

packages/sql/src/AbstractSqlConnection.ts:110–121  ·  view source on GitHub ↗

* @inheritDoc

()

Source from the content-addressed store, hash-verified

108 * @inheritDoc
109 */
110 async checkConnection(): Promise<{ ok: true } | { ok: false; reason: string; error?: Error }> {
111 if (!this.connected) {
112 return { ok: false, reason: 'Connection not established' };
113 }
114
115 try {
116 await this.getClient().executeQuery(CompiledQuery.raw('select 1'));
117 return { ok: true };
118 } catch (error: any) {
119 return { ok: false, reason: error.message, error };
120 }
121 }
122
123 /** Returns the underlying Kysely client, creating it synchronously if needed. */
124 getClient<T = any>(): Kysely<T> {

Callers

nothing calls this directly

Calls 2

getClientMethod · 0.80
executeQueryMethod · 0.45

Tested by

no test coverage detected