import { IDatabaseTableQuery, IValueType, ValueTypeOmitId } from '.'; /** * The key-value database table connector interface. * @category Connector */ export interface IKeyValueDatabaseTableConnector { /** * Get the value for a key. * @param key The key to get the value for. * @returns A promise that resolves with the value for the key, or undefined if the key was not found. */ get(key: string): Promise; /** * Set the value for a key. * @param key The key to set the value for. * @param value The value to set for the key. It must be a {@link SupportedIndexType}. */ set(key: string, value: ValueTypeOmitId): Promise; /** * Add a value to the database. * @param value The value to add. It must be a {@link SupportedIndexType}. * @returns A promise that resolves with the value added. */ add(value: ValueTypeOmitId): Promise; /** * Delete a key. * @param key The key to delete. * @returns A promise that resolves when the key has been deleted. */ delete(key: string): Promise; /** * Clear the database. * Fires a {@link IDatabaseTableEvent} for each key deleted. * @returns A promise that resolves when the database has been cleared. */ clear(): Promise; /** * Get all the values matching the query in the database. * @param query The query to use to filter the values. * If no query is provided, all the values in the database are returned. * @returns A promise that resolves with all the values matching the query. */ list(query?: IDatabaseTableQuery): Promise; /** * Count the number of keys matching the query in the database. * @param query The query to use to filter the keys. * If no query is provided, all the keys in the database are counted. * @returns A promise that resolves with the number of keys matching the query. */ count(query?: IDatabaseTableQuery): Promise; /** * Calculate the size of the table. * @returns A promise that resolves with the size of the table in bytes. */ calculateSize(): Promise; }