RejectedSoftware Forums

Sign up

Redis hget need help

Hi, I just grabbed the lastest and am now having trouble using hget

This line auto test = redis.hget!(char[],char)(auth.getAuthInfo(req).email, "LastDay");

is returning

Running dmd (compile)...
../../../../.dub/packages/vibe-d-master/source/vibe/db/redis/redis.d(576): Error: static assert "Unsupported Redis reply type: char[]"
../../../../.dub/packages/vibe-d-master/source/vibe/db/redis/redis.d(283): instantiated from here: _request!(char[], string, string)
../../../../.dub/packages/vibe-d-master/source/vibe/db/redis/redis.d(123): instantiated from here: request!(char[], string, string)
source/app.d(56): instantiated from here: hget!(char[], char)
Error: Build command failed with exit code 1

Re: Redis hget need help

On 2014-02-23 23:09, NoBodyKnows wrote:> This line auto test = redis.hget!(char[],char)(auth.getAuthInfo(req).email, "LastDay");

../../../../.dub/packages/vibe-d-master/source/vibe/db/redis/redis.d(576): Error: static assert "Unsupported Redis reply type: char[]"

There's a few issues I see:

  • You're calling hget with template parameters: `hget!(char[], char), although the template definition hget(T : E[], E) uses argument deduction (http://dlang.org/template.html) to define the value for E, so you could just as well use hget!(char[])`

  • You are requesting the char[] type here, you could just as well ask a string because it's an alias for immutable(char)[], which is optimal as a return type.

  • The error at line 576 is with `} else static if (is(T == string)) {, which should be } else static if (isSomeString!T) {`, which forces you to use hget!string instead of hget!(char[]). heh ;)