UNPKG

@safient/core

Version:

JavaScript SDK to manage safes and interact with Safient protocol.

25 lines (24 loc) 931 B
import { Connection, Safe, User } from '../../lib/types'; import { DatabaseType } from '../../lib/enums'; import { ThreadDB } from '../utils/threadDB'; export declare class Database { db: ThreadDB; private connection; private dbName; /** * * @param dbName - Database which should be used * @param connection - Connection Object of the chosen database */ constructor(dbName: DatabaseType, connection: Connection); /** * * @param data - Data that needs to be created * @param collection - Collection on which data has to be saved * @returns */ create: (data: any, collection: string) => Promise<string[]>; save: (data: any, collection: string) => Promise<boolean>; delete: (data: any, collection: string) => Promise<boolean>; read: <T extends User | Safe>(queryVariable: string, queryValue: string | boolean, collection: string) => Promise<T[]>; }