import type { DeleteResult, Document, InsertOneResult, Collection as MongoCollection, UpdateResult } from "mongodb"; import pg from "pg"; import type { App, Config } from "../main.js"; import Datastore from "./datastore-abstract.js"; import type { OutputOptions } from "./datastore.js"; import PostgresClient from "./postgres-client.js"; import type { QueryStage } from "./query-stage.js"; export type PostgresConfig = Config["datastore_postgres"]; export default class PostgresDatastore extends Datastore { client: PostgresClient; start(): Promise; stop(): Promise; getClient(): PostgresClient; find(collection_name: string, query: Record, options: Parameters[1], output_options: OutputOptions): Promise[]>; aggregate(collection_name: string, pipeline: QueryStage[], _: unknown, output_options: OutputOptions): Promise[]>; insert(collection_name: string, to_insert: Record, options?: Parameters[1]): Promise>; update(collection_name: string, query: unknown, new_value: unknown): Promise>; remove(collection_name: string, query: unknown, just_one: boolean): Promise; private postStart; /** * Method is meant for testing when you need to execute single quick query * to check state of the database or clean database afetr * @param config config to connect to postgress (database name will be skipped) * @param query SQL formatted string */ static executePlainQuery(app: App, config: PostgresConfig, query: string): Promise>; private checkForDatabase; }