Last active
September 2, 2017 06:34
-
-
Save cipepser/e6d4ca51b7b23914fadd5bdc0ec93c75 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"errors" | |
"fmt" | |
"os" | |
"github.com/garyburd/redigo/redis" | |
) | |
func main() { | |
// connect to redis | |
c, err := redis.Dial("tcp", ":6379") | |
if err != nil { | |
panic(err) | |
} | |
defer c.Close() | |
if len(os.Args) != 1 { | |
errors.New("please input artist name.") | |
} | |
rep, err := redis.Strings(c.Do("LRANGE", os.Args[1], "0", "-1")) | |
if err != nil || len(rep) == 0 { | |
fmt.Println("`", os.Args[1], "` is not found.") | |
} else { | |
for _, r := range rep { | |
fmt.Println(r) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment