Driver<DB>
declare abstract class Driver<DB> {
constructor(connStr: string);
abstract exec(sql: string, params: any[]): Promise<void>;
abstract query<T>(sql: string, params: any[]): Promise<T[]>;
q<T>(strings: TemplateStringsArray, ...params: any[]): Promise<T[]>;
e(strings: TemplateStringsArray, ...params: any[]): Promise<void>;
destroy(): Promise<void>;
}
This class should not be constructed directly; instead, use connect
to connect to a database.
The DB
type parameter is for internal use and should generally be set to any
in type signatures.
The destroy
method should always be called at the end of your program to close the database connection.
For more information on query
, exec
, q
, and e
, see Querying.