-
Notifications
You must be signed in to change notification settings - Fork 1.2k
FAQ
Gary Burd edited this page Oct 7, 2013
·
15 revisions
The args parameter to the connection Send and Do methods is variadic. Use the ... notation to pass a slice to a variadic argument.
// Set multiple HASH fields using values in map fvs.
var args []interface{"key"}
for f, v := range fvs {
args = append(args, f, v)
}
_, err := conn.Do("HMSET", args...)
If you have a slice that's not of type []interface{}, then copy the values to a []interface{} before calling the Send or Do method.
Redigo's Args type can be used to construct variable length argument lists.
Some Redis command names contain a space. Use the full name with the space as the first argument to the connection Send and Do methods:
_, err := conn.Do("CONFIG SET", "loglevel", "warning")