gomodule / redigo

Go client for Redis
Apache License 2.0
9.76k stars 1.25k forks source link

Need a way to execute arbitrary redis commands on a connection from a `Pool` #635

Closed dcormier closed 2 years ago

dcormier commented 2 years ago

The Pool interface changed in v3. In v2 and prior, Pool.Get() returned a github.com/gomodule/redigo/redis.Conn, which you can call .Do() on to execute arbitrary redis commands (there are many).

The Pool interface from v3 on returns a github.com/go-redsync/redsync/v4/redis.Conn, which only exposes helper methods and not a method for executing arbitrary redis commands (other than through scripting).

I have a need to redis commands other than those for which github.com/go-redsync/redsync/v4/redis.Conn does not expose methods. Scripting is unnecessarily complex to issue single commands.

It would be useful if the Conn interface exposed something like the github.com/gomodule/redigo/redis.Conn.Do() method for arbitrary redis commands. It would be simple, but it would require a incrementing the major version since it breaks compatibility. As bcmills pointed out in #634, that's why returning an interface is not a good idea.

stevenh commented 2 years ago

I think you posted this in the wrong repo, looks like you're trying to report something to github.com/go-redsync/redsync/issues

dcormier commented 2 years ago

Yes, you're right. Sorry about that. I've created go-redsync/redsync#104.