func getArticle(client redis.Client, page int, order string) []map[string]string { if order == "" { order = "score:" } start := (page - 1) * ARTICLES_PER_PAGE end := start + ARTICLES_PER_PAGE - 1 ids, err := client.Zrevrange(order, start, end) if err != nil { log.Fatal("Zrevrange エラーだよ", err.Error()) } articles := make([]map[string]string, 0) for _, id := range ids { articleData := make(map[string]string, 0) if err := client.Hgetall(string(id), articleData); err != nil { log.Fatal("Hgetall エラーだよ", err.Error()) } articleData["id"] = string(id) articles = append(articles, articleData) } return articles }