mmkal / handy-redis

A wrapper around node_redis with Promise and TypeScript support.
Apache License 2.0
172 stars 10 forks source link

How to use SCRIPT LOAD? #221

Closed karli2000 closed 4 years ago

karli2000 commented 4 years ago

Hi,

i love handy-redis, makes it so much easier with Typescript!

But i have one issue: we need Lua-scripts and i am missing the SCRIPT LOAD (https://redis.io/commands/script-load ) command. I know, i can use it with .redis.script('LOAD') but only with callbacks, or?

Thank you, Max

mmkal commented 4 years ago

Hi @karli2000 - right now it's not supported. https://github.com/redis/redis-doc puts SCRIPT and some other commands in a strange format which trips up the codegen. I'm testing out a workaround.

In the meantime, yes I'd use .redis.script. There won't be typescript support or documentation, but you can use import { promisify } from 'util' to avoid callbacks.

mmkal commented 4 years ago

Fixed in v2: you can now call await client.script('LOAD', myScript). Signature here: https://github.com/mmkal/handy-redis/blob/a9305ea814ba95700a4270cdedcf6f2f6d31e55f/src/generated/interface.ts#L5826-L5834