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

Function constructor

packages/core/src/connections/Connection.ts:35–63  ·  view source on GitHub ↗
(
    protected readonly config: Configuration,
    options?: ConnectionOptions,
    protected readonly type: ConnectionType = 'write',
  )

Source from the content-addressed store, hash-verified

33 }
34
35 constructor(
36 protected readonly config: Configuration,
37 options?: ConnectionOptions,
38 protected readonly type: ConnectionType = 'write',
39 ) {
40 this.logger = this.config.getLogger();
41 this.platform = this.config.getPlatform();
42
43 if (options) {
44 this.options = Utils.copy(options);
45 } else {
46 const props = [
47 'dbName',
48 'clientUrl',
49 'host',
50 'port',
51 'user',
52 'password',
53 'multipleStatements',
54 'pool',
55 'schema',
56 'driverOptions',
57 ] as const;
58 this.options = props.reduce((o, i) => {
59 (o[i] as any) = this.config.get(i);
60 return o;
61 }, {} as ConnectionOptions);
62 }
63 }
64
65 /**
66 * Establishes connection to database

Callers

nothing calls this directly

Calls 5

copyMethod · 0.80
reduceMethod · 0.80
getLoggerMethod · 0.65
getPlatformMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected