@getanthill/datastore
Version:
Event-Sourced Datastore
25 lines (24 loc) • 1.17 kB
TypeScript
import type { ClientConfig, QueryResult } from 'pg';
import { ModelConfig } from '../typings';
export interface PostgreSQLClientConfig {
client: ClientConfig;
namespace: string;
}
export default class PostgreSQLClient {
static ERRORS: {};
private _config;
private _client;
constructor(config: PostgreSQLClientConfig);
static init(config: PostgreSQLClientConfig): Promise<void>;
connect(): Promise<void>;
disconnect(): Promise<void>;
static getTableBaseName(modelConfig: Partial<ModelConfig>, namespace?: string): string;
static getSqlSchemaForModelDeletion(modelConfig: Partial<ModelConfig>, namespace?: string): string[];
static getSqlSchemaForModel(modelConfig: Partial<ModelConfig>, namespace?: string): string[];
static getSqlSchemaForModels(modelConfigs: Partial<ModelConfig>[], mustClean?: boolean, namespace?: string): string[];
query(q: string): Promise<QueryResult<any>>;
queryAll(queries: string[]): Promise<QueryResult<any>[]>;
insert(modelConfig: Partial<ModelConfig>, source: 'events' | 'entities', data: any, options?: {
with_encrypted_data: boolean;
}): Promise<QueryResult<any>>;
}