import { default } from "https://deno.land/x/justaos_orm@v9.1.2/src/connection/DatabaseConnection.ts";
DatabaseConnection class manages the connection to the database.
Examples
Example 1
Example 1
new DatabaseConnection({
host: "127.0.0.1",
port: 5432,
username: "postgres",
password: "postgres",
database: "project-management-system"
});
Constructors
new
default(configuration: DatabaseConfiguration, logger?: Logger)Methods
closeConnection(): Promise<void>
Closes the database connection.
connect(): Promise<void>
Establishes a connection to the database.
createDatabase(databaseName: string): Promise<any>
Creates a database.
dropDatabase(databaseName: string): Promise<any>
Drops a database.
getConnectionPool(): Pool
Returns the connection pool.
getDatabaseName(): string | undefined
Returns the database name.
isDatabaseExist(databaseName: string): Promise<boolean>
Checks if a database exists.
Static Methods
connect(configuration: DatabaseConfiguration)