只读@instanceofDatabase driver used by this connection.
只读entityAll entity metadatas that are registered for this connection.
只读entityAll entity metadatas that are registered for this connection. This is a copy of #.entityMetadatas property -> used for more performant searches.
只读isIndicates if DataSource is initialized or not.
Logger used to log orm events.
只读managerEntityManager of this connection.
只读metadataName for the metadata table
只读migrationsMigration instances that are registered for this connection.
只读nameConnection name.
Naming strategy used in the connection.
只读optionsConnection options.
可选queryUsed to work with query result cache.
只读relation只读relationUsed to load relations and work with lazy relations.
只读subscribersEntity subscriber instances that are registered for this connection.
Gets the mongodb entity manager that allows to perform mongodb-specific repository operations with any entity in this connection.
Available only in mongodb connections.
Gets a sql.js specific Entity Manager that allows to perform special load and save operations
Available only in connection with the sqljs driver.
受保护buildBuilds metadatas for all registered classes inside this connection.
Performs connection to the database. This method should be called once on application bootstrap. This method not necessarily creates database connection (depend on database type), but it also can setup a connection pool with database to use.
Creates an Entity Manager for the current connection with the help of the EntityManagerFactory.
可选queryRunner: QueryRunnerCreates a new query builder that can be used to build a SQL query.
可选queryRunner: QueryRunnerCreates a new query builder that can be used to build a SQL query.
可选queryRunner: QueryRunnerCreates a query runner used for perform queries on a single database connection. Using query runners you can control your queries to execute using single database connection and manually control your database transaction.
Mode is used in replication mode and indicates whatever you want to connect to master database or any of slave databases. If you perform writes you must use master database, if you perform reads you can use slave databases.
可选mode: ReplicationModeGet the replication mode SELECT queries should use for this datasource by default
Closes connection with the database. Once connection is closed, you cannot use repositories or perform any operations except opening connection again.
Drops the database and all its data. Be careful with this method on production since this method will erase all your database tables and their data. Can be used only after connection to the database is established.
受保护findFinds exist entity metadata by the given entity class, target name or table name.
Gets entity metadata of the junction table (many-to-many table).
Gets entity metadata for the given entity class or schema name.
Gets mongodb-specific repository for the given entity class or name. Works only if connection is mongodb-specific.
Gets repository for the given entity.
Gets tree repository for the given entity class or name. Only tree-type entities can have a TreeRepository, like ones decorated with
Checks if entity metadata exist for the given entity class, target name or table name.
Performs connection to the database. This method should be called once on application bootstrap. This method not necessarily creates database connection (depend on database type), but it also can setup a connection pool with database to use.
Executes raw SQL query and returns raw database results.
可选parameters: any[]可选queryRunner: QueryRunnerOfficial docs for examples.
Updates current connection options with provided options.
Lists all migrations and whether they have been run. Returns true if there are pending migrations
Creates database schema for all entities registered in this connection. Can be used only after connection to the database is established.
可选dropBeforeSync: booleanIf set to true then it drops the database with all its tables and data
Wraps given function execution (and all operations made there) into a transaction. All database operations must be executed using provided entity manager.
Wraps given function execution (and all operations made there) into a transaction. All database operations must be executed using provided entity manager.
Connection is a single database ORM connection to a specific database. Its not required to be a database connection, depend on database type it can create connection pool. You can have multiple connections to multiple databases in your application.
已被弃用