Skip to content

Commit

Permalink
[FEAT] Add new commands
Browse files Browse the repository at this point in the history
- INCR commands
  • Loading branch information
captchanjack committed Jun 10, 2021
1 parent a0eed8a commit c39136e
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Jedis"
uuid = "b89ccfe0-2c5f-46f6-b89b-da3e1c2e286f"
authors = ["Jack Chan <[email protected]>"]
version = "0.1.1"
version = "0.1.2"

[deps]
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
Expand Down
6 changes: 6 additions & 0 deletions docs/src/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ blpop
brpop
llen
lrange
incr
incrby
incrbyfloat
hincrby
hincrbyfloat
zincrby
```
44 changes: 43 additions & 1 deletion src/commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,46 @@ llen(key; client=get_global_client()) = execute(["LLEN", key], client)
Get a range of elements from a list.
"""
lrange(key, start, stop; client=get_global_client()) = execute(["LRANGE", key, start, stop], client)
lrange(key, start, stop; client=get_global_client()) = execute(["LRANGE", key, start, stop], client)

"""
incr(key)
Increment the integer value of a key by one.
"""
incr(key; client=get_global_client()) = execute(["INCR", key], client)

"""
incrby(key, increment)
Increment the integer value of a key by the given amount.
"""
incrby(key, increment; client=get_global_client()) = execute(["INCRBY", key, increment], client)

"""
incrbyfloat(key, increment)
Increment the float value of a key by the given amount.
"""
incrbyfloat(key, increment; client=get_global_client()) = execute(["INCRBYFLOAT", key, increment], client)

"""
hincrby(key, field, increment)
Increment the integer value of a hash field by the given number.
"""
hincrby(key, increment; client=get_global_client()) = execute(["HINCRBY", key, field, increment], client)

"""
hincrbyfloat(key, field, increment)
Increment the float value of a hash field by the given number.
"""
hincrbyfloat(key, field, increment; client=get_global_client()) = execute(["HINCRBYFLOAT", key, field, increment], client)

"""
zincrby(key, field, member)
Increment the score of a member in a sorted set.
"""
zincrby(key, field, increment; client=get_global_client()) = execute(["ZINCRBY", key, field, increment], client)

2 comments on commit c39136e

@captchanjack
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/38568

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.2 -m "<description of version>" c39136eafca40bf5524ca02738e4c4e01c02ac7b
git push origin v0.1.2

Please sign in to comment.