Skip to content

@142vip.nest typeorm.类.ConnectionOptionsReader

mmdapl edited this page Oct 8, 2026 · 1 revision

API 参考 / @142vip/nest-typeorm / ConnectionOptionsReader

类: ConnectionOptionsReader

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:5

Reads connection options from the ormconfig.

构造函数

构造函数

new ConnectionOptionsReader(options?): ConnectionOptionsReader

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:17

参数

options?
configName?

string

Filename of the ormconfig configuration. By default its equal to "ormconfig".

root?

string

Directory where ormconfig should be read from. By default its your application root (where your app package.json is located).

返回

ConnectionOptionsReader

属性

options?

protected optional options?: object

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:6

configName?

optional configName?: string

Filename of the ormconfig configuration. By default its equal to "ormconfig".

root?

optional root?: string

Directory where ormconfig should be read from. By default its your application root (where your app package.json is located).

访问器

baseConfigName

Getter 签名

get protected baseConfigName(): string

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:62

Gets configuration file name.

返回

string


baseDirectory

Getter 签名

get protected baseDirectory(): string

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:58

Gets directory where configuration file should be located.

返回

string


baseFilePath

Getter 签名

get protected baseFilePath(): string

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:54

Gets directory where configuration file should be located and configuration file name.

返回

string

方法

all()

all(): Promise<DataSourceOptions[]>

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:31

Returns all connection options read from the ormconfig.

返回

Promise<DataSourceOptions[]>


get()

get(name): Promise<DataSourceOptions>

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:36

Gets a connection with a given name read from ormconfig. If connection with such name would not be found then it throw error.

参数

name

string

返回

Promise<DataSourceOptions>


has()

has(name): Promise<boolean>

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:40

Checks if there is a TypeORM configuration file.

参数

name

string

返回

Promise<boolean>


load()

protected load(): Promise<DataSourceOptions[] | undefined>

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:46

Loads all connection options from a configuration file.

todo: get in count NODE_ENV somehow

返回

Promise<DataSourceOptions[] | undefined>


normalizeConnectionOptions()

protected normalizeConnectionOptions(connectionOptions): DataSourceOptions[]

定义于: node_modules/.pnpm/typeorm@0.3.30_ioredis@5.6.0_mongodb@6.19.0_mssql@11.0.1_mysql2@3.15.1_pg@8.11.3_ts-node@10.9_6zvdq3z7xgsf663jy3j6oymho4/node_modules/typeorm/connection/ConnectionOptionsReader.d.ts:50

Normalize connection options.

参数

connectionOptions

DataSourceOptions | DataSourceOptions[]

返回

DataSourceOptions[]

Clone this wiki locally