import { CreateIndexOptions } from './contracts/fullText/createIndexOptions.js'; import { EXPIRE_OPTION } from './enums/expireOption.js'; import { ISearchOptions } from './enums/fullText/ISearchOptions.js'; /** * Represents a state object that can be used to store and retrieve data. * @interface */ export interface IState { /** * Sets the value for a key in the state object. * @param {string} key - The key to set. * @param {T} value - The value to set for the key. * @returns {Promise} A promise that resolves to "OK" if the operation was successful. */ set(key: string, value: T): Promise; /** * Retrieves the value for a key in the state object. * @param {string} key - The key to retrieve. * @returns {Promise} A promise that resolves to the value for the key. */ get(key: string): Promise; /** * Deletes a key from the state object. * @param {string} key - The key to delete. * @returns {Promise} A promise that resolves to "1" if the key was deleted, or "0" if the key did not exist. */ delete(key: string): Promise; /** * Increments the value of a key in the state object by a specified amount. * @param {string} key - The key to increment. * @param {number} value - The amount to increment the key by. * @returns {Promise} A promise that resolves to the new value of the key. */ increment(key: string, value: number): Promise; /** * Decrements the value of a key in the state object by a specified amount. * @param {string} key - The key to decrement. * @param {number} value - The amount to decrement the key by. * @returns {Promise} A promise that resolves to the new value of the key. */ decrement(key: string, value: number): Promise; /** * Sets an expiration time for a key in the state object. * @param {string} key - The key to set the expiration time for. * @param {number} seconds - The number of seconds after which the key will expire. * @param {EXPIRE_OPTION} [option] - An optional object specifying additional options for the operation. * @returns {Promise} A promise that resolves to "1" if the operation was successful, or "0" if the key does not exist. */ expire(key: string, seconds: number, option?: EXPIRE_OPTION): Promise; /** * Deletes a key from a hash table in the state object. * @param {string} table - The name of the hash table. * @param {string[]} keys - The keys to delete from the hash table. * @returns {Promise} A promise that resolves to "1" if the key was deleted, or "0" if the key did not exist. */ mapDelete(table: string, keys: string[]): Promise; /** * Determines whether a key exists in a hash table in the state object. * @param {string} table - The name of the hash table. * @param {string} key - The key to check for in the hash table. * @returns {Promise} A promise that resolves to "1" if the key exists, or "0" if the key does not exist. */ mapExists(table: string, key: string): Promise; /** * Retrieves all keys and values from a hash table in the state object. * @param {string} table - The name of the hash table. * @returns {Promise>} A promise that resolves to an object containing the keys and values from the hash table. */ mapGetAll(table: string): Promise>; /** * Retrieves multiple values from a hash table in the state object. * @param {string} table - The name of the hash table. * @param {string[]} keys - The keys to retrieve from the hash table. * @returns {Promise} A promise that resolves to an array of values for the specified keys. */ mapGetMultiple(table: string, keys: string[]): Promise; /** * Retrieves all values from a hash table in the state object. * @param {string} table - The name of the hash table. * @returns {Promise} A promise that resolves to an array of values from the hash table. */ mapGetValues(table: string): Promise; /** * Retrieves the value for a key in a hash table in the state object. * @param {string} table - The name of the hash table. * @param {string} key - The key to retrieve from the hash table. * @returns {Promise} A promise that resolves to the value for the key in the hash table. */ mapGetValue(table: string, key: string): Promise; /** * Increments the value for a key in a hash table in the state object. * @param {string} table The name of the hash table. * @param {string} key The key to increment. * @param {number} value The amount to increment the key by. * @returns {Promise} A promise that resolves to the new value for the key. */ mapIncrement(table: string, key: string, value: number): Promise; /** * Retrieves the number of key-value pairs in a hash table in the state object. * @param {string} table - The name of the hash table. * @returns {Promise} A promise that resolves to the number of key-value pairs in the hash table. */ mapLength(table: string): Promise; /** * Sets multiple key-value pairs in a hash table in the state object. * @param {string} table - The name of the hash table. * @param {Record} keyValuePairs - An object containing the key-value pairs to set in the hash table. * @returns {Promise} A promise that resolves to "OK" if the operation was successful. */ mapSet(table: string, keyValuePairs: Record): Promise; /** * TODO * @param {string} table - The name of the hash table. * @param {string} cursor - * @param {string} pattern - * @param {number} count - * @returns {Promise<[string, string[]]>} */ mapScan(table: string, cursor: string, pattern?: string, count?: number): Promise<[string, string[]]>; /** * Adds a value to the end of a list in the state object. * @param {string} list - The name of the list. * @param {T} value - The value to add to the list. * @returns {Promise} A promise that resolves to the new length of the list. */ listAppend(list: string, value: T): Promise; /** * Adds a value to the beginning of a list in the state object. * @param {string} list - The name of the list. * @param {T} value - The value to add to the list. * @returns {Promise} A promise that resolves to the new length of the list. */ listPrepend(list: string, value: T): Promise; /** * Removes and retrieves one or more values from the end of a list in the state object. * @param {string} list - The name of the list. * @param {number} count - The number of values to remove and retrieve from the end of the list. * @returns {Promise} A promise that resolves to an array of values removed from the end of the list. */ listEndPop(list: string, count: number): Promise; /** * Removes and retrieves one or more values from the beginning of a list in the state object. * @param {string} list - The name of the list. * @param {number} count - The number of values to remove and retrieve from the beginning of the list. Default is 1. * @returns {Promise} A promise that resolves to an array of values removed from the beginning of the list. */ listStartPop(list: string, count: number): Promise; /** * Removes one or more occurrences of a value from a list in the state object. * @param {string} list - The name of the list. * @param {T} value - The value to remove from the list. * @param {number} count - The number of occurrences to remove. A positive number removes the first `count` occurrences, a negative number removes the last `count` occurrences, and a value of 0 removes all occurrences. * @returns {Promise} A promise that resolves to the number of occurrences removed from the list. */ listRemove(list: string, value: T, count: number): Promise; /** * Trims a list in the state object to contain only the specified range of values. * @param {string} list - The name of the list. * @param {number} startPos - The starting position of the range. * @param {number} endPos - The ending position of the range. * @returns {Promise} A promise that resolves to "OK" if the operation was successful. */ listTrim(list: string, startPos: number, endPos: number): Promise; /** * Inserts a value into a list in the state object either before or after a pivot value. * @param {string} list - The name of the list. * @param {boolean} before - If `true`, the value is inserted before the pivot value. If `false`, the value is inserted after the pivot value. * @param {T} pivot - The pivot value. * @param {T} value - The value to insert into the list. * @returns {Promise} A promise that resolves to the new length of the list if the operation was successful. */ listInsert(list: string, before: boolean, pivot: T, value: T): Promise; /** * Retrieves the value at a specific position in a list in the state object. * @param {string} list - The name of the list. * @param {number} position - The position of the value to retrieve. * @returns {Promise} A promise that resolves to the value at the specified position in the list. */ listIndex(list: string, position: number): Promise; /** * Sets the value at a specific position in a list in the state object. * @param {string} list - The name of the list. * @param {number} position - The position of the value to set. * @param {T} value - The value to set at the specified position in the list. * @returns {Promise} A promise that resolves to "OK" if the operation was successful. */ listSet(list: string, position: number, value: T): Promise; /** * Retrieves the length of a list in the state object. * @param {string} list - The name of the list. * @returns {Promise} A promise that resolves to the length of the list. */ listLength(list: string): Promise; /** * Retrieves a range of values from a list in the state object. * @param {string} list - The name of the list. * @param {number} startPos - The starting position of the range. * @param {number} endPos - The ending position of the range. * @returns {Promise} A promise that resolves to an array of values from the specified range in the list. */ listRange(list: string, startPos: number, endPos: number): Promise; createIndex(name: string, options: CreateIndexOptions): Promise; search(index: string, query: string, options?: ISearchOptions): Promise; dropIndex(index: string, deleteDocs?: boolean): Promise; } //# sourceMappingURL=IState.d.ts.map