mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	* types: add types for database abstration layer Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com> * types: fix more type dependent return value cases Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com> * types: make INodeBBDatabaseBackend implement the five major interface set Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com> * update types * update type names * add reverse for options in processSortedSet * add getSortedSetMembersWithScores and getSortedSetsMembersWithScores --------- Signed-off-by: steve <29133953+stevefan1999-personal@users.noreply.github.com>
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { Store } from 'express-session'
 | |
| 
 | |
| export { Hash } from './hash'
 | |
| export { List } from './list'
 | |
| export { Set } from './set'
 | |
| export { Item } from './string'
 | |
| export {
 | |
|   SortedSet,
 | |
|   SortedSetTheoryOperation,
 | |
|   SortedSetScanBaseParameters,
 | |
| } from './zset'
 | |
| 
 | |
| export interface Database {
 | |
|   checkCompatibility(callback: () => void): Promise<void>
 | |
| 
 | |
|   checkCompatibilityVersion(
 | |
|     version: string,
 | |
|     callback: () => void,
 | |
|   ): Promise<void>
 | |
| 
 | |
|   close(): Promise<void>
 | |
| 
 | |
|   createIndices(callback: () => void): Promise<void>
 | |
| 
 | |
|   createSessionStore(options: any): Promise<Store>
 | |
| 
 | |
|   emptydb(): Promise<void>
 | |
| 
 | |
|   flushdb(): Promise<void>
 | |
| 
 | |
|   info(db: any): Promise<any>
 | |
| 
 | |
|   init(): Promise<void>
 | |
| }
 | |
| 
 | |
| export type RedisStyleMatchString =
 | |
|   | string
 | |
|   | `*${string}`
 | |
|   | `${string}*`
 | |
|   | `*${string}*`
 | |
| export type RedisStyleRangeString = `${'(' | '['}${string}` | `${string}`
 | |
| 
 | |
| export enum ObjectType {
 | |
|   HASH = 'hash',
 | |
|   LIST = 'list',
 | |
|   SET = 'set',
 | |
|   STRING = 'string',
 | |
|   SORTED_SET = 'zset',
 | |
| }
 | |
| 
 | |
| export type ValueAndScore = { value: string; score: number }
 | |
| export type RedisStyleAggregate = 'SUM' | 'MIN' | 'MAX'
 | |
| export type NumberTowardsMinima = number | '-inf'
 | |
| export type NumberTowardsMaxima = number | '+inf'
 |