ram64
Version:
Multi-threaded 64bit memory cache database inspired by redis-like features
18 lines (13 loc) • 558 B
text/typescript
import { commands as commandsArr, commandsDict, Command, CommandFn } from '../../commands';
export const commands: Command[] = commandsArr;
function wireupCommand(commandName: string, commandFn: CommandFn) {
const cmd = commandsDict[commandName];
if (!cmd) throw new Error(`Command "${commandName}" not found`);
commandsArr[cmd.index].fn = commandFn;
}
export async function init() {
for (let cmd of commands) {
const { fn } = await import(`./${cmd.name}`);
wireupCommand(cmd.name as string, fn);
}
}