Skip to content

Instantly share code, notes, and snippets.

@marselester
Created November 3, 2015 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marselester/0a68b645de9fed3a4b8c to your computer and use it in GitHub Desktop.
Save marselester/0a68b645de9fed3a4b8c to your computer and use it in GitHub Desktop.
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