UNPKG

@grandlinex/bundle-postgresql

Version:
30 lines (29 loc) 2.33 kB
import { ConfigType, CoreDBCon, CoreEntity, EntityConfig, EProperties, EUpDateProperties, ICoreCache, ICoreClient, ICoreKernel, ICoreKernelModule, ICorePresenter, IDataBase, IEntity, QInterfaceSearch, QueryInterface, RawQuery } from '@grandlinex/core'; import { Client, QueryResult } from 'pg'; type PGDBType = Client; export default class PGCon<K extends ICoreKernel<any> = ICoreKernel<any>, T extends IDataBase<any, any> | null = any, P extends ICoreClient | null = any, C extends ICoreCache | null = any, X extends ICorePresenter<any> | null = any> extends CoreDBCon<PGDBType, QueryResult | null, K, T, P, C, X> implements IDataBase<PGDBType, QueryResult | null, K, T, P, C, X> { db: PGDBType | null; printLog: boolean; constructor(module: ICoreKernelModule<any, any, any, any, any>, dbversion: string, printLog?: boolean); createEntity<E extends CoreEntity>(config: EntityConfig<E>, entity: EProperties<E>): Promise<E>; updateEntity<E extends CoreEntity>(config: EntityConfig<E>, e_id: string, entity: EUpDateProperties<E>): Promise<boolean>; updateBulkEntity<E extends IEntity>(config: EntityConfig<E>, e_id: string[], entity: EUpDateProperties<E>): Promise<boolean>; getEntityById<E extends CoreEntity>(config: EntityConfig<E>, e_id: string): Promise<E | null>; getEntityBulkById<E extends CoreEntity>(config: EntityConfig<E>, e_id: string[]): Promise<E[]>; deleteEntityById(className: string, e_id: string): Promise<boolean>; deleteEntityBulkById(className: string, e_id: string[]): Promise<boolean>; findEntity<E extends CoreEntity>(config: EntityConfig<E>, search: QInterfaceSearch<E>): Promise<E | null>; getEntityList<E extends CoreEntity>(q: QueryInterface<E>): Promise<E[]>; initEntity<E extends CoreEntity>(className: string, entity: E): Promise<boolean>; transformEntityKeys<E extends CoreEntity>(entity: E): string; removeConfig(key: string): Promise<void>; initNewDB(): Promise<void>; connect(): Promise<boolean>; getRawDBObject(): PGDBType | null; configExist(key: string): Promise<boolean>; setConfig(key: string, value: string): Promise<boolean>; getConfig(key: string): Promise<ConfigType | undefined>; execScripts(list: RawQuery[]): Promise<(QueryResult | null)[]>; disconnect(): Promise<boolean>; } export {};