FAQ
I'm getting this failure with redigo [1]

ERR unknown command '"HMSET", "wait:0", "email", "foo@mail.net", "passwd",
"pass1", "secret", "sec1", "newAcct", true, "existingUser", 0'

The format generated for testing comes from:

db.w.Send(fmt.Sprintf(
`"HMSET", "wait:%d", "email", %q, "passwd", %q, "secret", %q,
"newAcct", %t,
"existingUser", %d`,
i, v.email, v.passwd, v.secret, v.newAcct, v.existingUser))

What's wrong?


[1]: http://go.pkgdoc.org/github.com/garyburd/redigo/redis

--

Search Discussions

  • Gary b at Nov 30, 2012 at 11:42 pm
    What's wrong?
    The example code is formatting the command name and arguments as a string
    and using that string as the command name. Do this instead:

    err := db.w.Send("HMSET",
    "wait", i,
    "email", v.email,
    "passwd", v.passwd,
    "secret", v.secret,
    "newAcct", v.newAcct,
    "existingUser", v.existingUser)

    Unless you are pipelining commands, you want to use Do() instead of Send().

    --
  • Archos at Nov 30, 2012 at 11:52 pm
    El viernes, 30 de noviembre de 2012 23:35:47 UTC, gary b escribió:

    What's wrong?
    The example code is formatting the command name and arguments as a string
    and using that string as the command name. Do this instead:
    err := db.w.Send("HMSET",
    "wait", i,
    "email", v.email,
    "passwd", v.passwd,
    "secret", v.secret,
    "newAcct", v.newAcct,
    "existingUser", v.existingUser)

    Unless you are pipelining commands, you want to use Do() instead of Send().
    I'm pipeling using:

    db.w.Send("MULTI")
    db.w.Send("HMSET", ...)
    and finally, db.w.Do("EXEC")

    Thanks! By the way, I just start to play with redigo and looks awesome.

    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 30, '12 at 8:42p
activeNov 30, '12 at 11:52p
posts3
users2
websitegolang.org

2 users in discussion

Archos: 2 posts Gary b: 1 post

People

Translate

site design / logo © 2021 Grokbase