Harrison88 / redtrio

4 stars 0 forks source link

Support BITFIELD command on midlevel client #15

Open Harrison88 opened 3 years ago

Harrison88 commented 3 years ago

The BITFIELD command is pretty complicated, involving subcommands and different arguments for each, all of which are able to be specified multiple times.

For reference, here's the command: BITFIELD key [GET type offset] [SET type offset value] [INCRBY type offset increment] [OVERFLOW WRAP|SAT|FAIL]

Preferably, there would be a way to make the function call signature look at least somewhat like that. I suspect, though, that bitfield(self, *args: str) is the best it's going to get.

Harrison88 commented 3 years ago

Redis-py implements this as a class, so you can do something like client.bitfield(key).get(args).set(args).execute() and such like. https://github.com/andymccurdy/redis-py/blob/master/redis/client.py#L4196