import { default } from "https://deno.land/x/justaos_orm@v10.1.0/src/core/connection/DatabaseConnectionPool.ts";
DatabaseConnectionPool class manage connections to the database.
Examples
Example 1
Example 1
new DatabaseConnectionPool({
host: "127.0.0.1",
port: 5432,
username: "postgres",
password: "postgres",
database: "project-management-system"
});
Constructors
new
default(configuration: TDatabaseConfiguration, logger?: Logger)Methods
connect(): Promise<DatabaseClient>
Returns a connection to the database.
createDatabase(databaseName: string): Promise<any>
Creates a database.
dropDatabase(databaseName: string): Promise<any>
Drops a database.
end(): void
executeQuery(query: string): Promise<pg.QueryResult>
getDatabaseName(): string | undefined
Returns the database name.
on(event: string, callback: any)
testConnection(): Promise<void>
Establishes a connection to the database.
Static Methods
createConnectionPoll(configuration: TDatabaseConfiguration): Promise<DatabaseConnectionPool>
Creates a connection to the database. And test the connection.