Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow "nothing" returns for evalscript #110

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ function convert_response(::Type{Dict{AbstractString, AbstractString}}, response
retdict
end

function convert_eval_response(::Any, response::Array)
return [String(r) for r in response]
end
function convert_eval_response(::Any, response)
return String(response)
end

# import Base: ==
# ==(A::Union{T, Nothing}, B::Union{U, Nothing}) where {T<:AbstractString, U<:AbstractString} = A == B
# ==(A::Union{T, Nothing}, B::Union{U, Nothing}) where {T<:Number, U<:Number} = A == B
Expand Down
2 changes: 1 addition & 1 deletion src/commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ end
# TODO: PipelineConnection and TransactionConnection
function evalscript(conn::RedisConnection, script, numkeys::Integer, args)
response = execute_command(conn, flatten_command("eval", script, numkeys, args))
convert_eval_response(Any, response)
return response
end

#################################################################
Expand Down
7 changes: 7 additions & 0 deletions test/redis_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,13 @@ function redis_tests(conn = RedisConnection())
@test resp == "OK"
del(conn, ky)

script = "return {10,20}"
resp = evalscript(conn, script, 0, [])
@test resp == [10, 20]

script = "return"
resp = evalscript(conn, script, 0, [])
@test resp === nothing

#@test evalscript(conn, "return {'1','2',{'3','Hello World!'}}", 0, []) == ["1"; "2"; ["3","Hello World!"]]

Expand Down
Loading