You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
545 B
21 lines
545 B
import {QueryResult} from './types.ts'
|
|
|
|
export class ConnectionNotReadyError extends Error {
|
|
constructor(name = '') {
|
|
super(`The connection ${name} is not ready and cannot execute queries.`)
|
|
}
|
|
}
|
|
|
|
export abstract class Connection {
|
|
|
|
constructor(
|
|
public readonly name: string,
|
|
public readonly config: any = {},
|
|
) {}
|
|
|
|
public abstract async init(): Promise<void>
|
|
public abstract async query(query: string): Promise<QueryResult> // TODO query result
|
|
public abstract async close(): Promise<void>
|
|
|
|
}
|