nalgeon / redka

Redis re-implemented with SQLite
BSD 3-Clause "New" or "Revised" License
3.24k stars 87 forks source link

Copy-paste mistake in README.md #6

Closed gorkaerana closed 2 months ago

gorkaerana commented 2 months ago

Hello :)

I believe there is a mistake in the "Strings" section of the README. Please do let me know if I'm wrong, I'd be happy to put in a PR fixing this. It currently looks like this

Command      Go API                 Description
-------      ------                 -----------
DECR         DB.Str().Incr          Decrements the integer value of a key by one.
DECRBY       DB.Str().Incr          Decrements a number from the integer value of a key.
GET          DB.Str().Get           Returns the value of a key.
GETSET       DB.Str().GetSet        Sets the key to a new value and returns the prev value.
INCR         DB.Str().Incr          Increments the integer value of a key by one.
INCRBY       DB.Str().Incr          Increments the integer value of a key by a number.
INCRBYFLOAT  DB.Str().IncrFloat     Increments the float value of a key by a number.
MGET         DB.Str().GetMany       Returns the values of one or more keys.
MSET         DB.Str().SetMany       Sets the values of one or more keys.
MSETNX       DB.Str().SetManyNX     Sets the values of one or more keys when all keys don't exist.
PSETEX       DB.Str().SetExpires    Sets the value and expiration time (in ms) of a key.
SET          DB.Str().Set           Sets the value of a key.
SETEX        DB.Str().SetExpires    Sets the value and expiration (in sec) time of a key.
SETNX        DB.Str().SetNotExists  Sets the value of a key when the key doesn't exist.

when (if I'm not mistaken) it should instead say the below

Command      Go API                 Description
-------      ------                 -----------
DECR         DB.Str().Incr          Decrements the integer value of a key by one.
DECRBY       DB.Str().IncrBy        Decrements a number from the integer value of a key.
GET          DB.Str().Get           Returns the value of a key.
GETSET       DB.Str().GetSet        Sets the key to a new value and returns the prev value.
INCR         DB.Str().Incr          Increments the integer value of a key by one.
INCRBY       DB.Str().IncrBy        Increments the integer value of a key by a number.
INCRBYFLOAT  DB.Str().IncrByFloat   Increments the float value of a key by a number.
MGET         DB.Str().GetMany       Returns the values of one or more keys.
MSET         DB.Str().SetMany       Sets the values of one or more keys.
MSETNX       DB.Str().SetManyNX     Sets the values of one or more keys when all keys don't exist.
PSETEX       DB.Str().SetExpires    Sets the value and expiration time (in ms) of a key.
SET          DB.Str().Set           Sets the value of a key.
SETEX        DB.Str().SetExpires    Sets the value and expiration (in sec) time of a key.
SETNX        DB.Str().SetNotExists  Sets the value of a key when the key doesn't exist.

Best regards, Gorka.

ravener commented 2 months ago

It took me a while to realize what had changed and in the end, I had to use diff, It would be helpful if you just pointed out the mistakes directly instead of sending the whole fixed thing with no comments on what changed :)

The changes here were that INCR and INCRBY both referred to the same Go-API of DB.Str().Incr() where as it should be using DB.Str().IncrBy() for the INCRBY commands.

nalgeon commented 2 months ago

The documentation is correct, the methods are called Incr and IncrFloat.