Created
November 3, 2015 09:45
-
-
Save marselester/0a68b645de9fed3a4b8c to your computer and use it in GitHub Desktop.
Go snippets for Redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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