c := db.Get() intoList := make([]*pa.Package, 0) err := db.GetEngine().Where("package_status=?", "0").And("package_id<>?", "0").Cols("package_id", "package_name").Find(&intoList) data, _ := json.Marshal(intoList) _, err = c.Do("SET", "package", data) if err != nil { fmt.Println(err) } t_data, err := redis.Bytes(c.Do("GET", "package")) if t_data == nil || len(t_data) <= 0 { fmt.Println("check erroor") return } var outList []*pa.Package err = json.Unmarshal(t_data, &outList) for _, v := range outList { fmt.Printf("%+v\n", *v) }
控制台打印:
网络异常,图片无法展示
|
redis 存入
网络异常,图片无法展示
|