Skip to content

Instantly share code, notes, and snippets.

@marselester
Created November 3, 2015 09:45
Go snippets for Redis
// redisArgs prepends a Redis key to Redis values slice.
// For example, we want to add "key1" to ["val1", "val2"] Redis values.
// The result will be ["key1", "val1", "val2"].
func redisArgs(key string, values ...string) []interface{} {
args := make([]interface{}, 0, len(values)+1)
args = append(args, key)
for _, v := range values {
args = append(args, v)
}
return args
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment