第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

redigo,SMEMBERS,如何獲取字符串

redigo,SMEMBERS,如何獲取字符串

Go
藍(lán)山帝景 2021-05-07 14:09:41
我是redigo,要從Go連接到redis數(shù)據(jù)庫。如何將類型轉(zhuǎn)換[]interface {}{[]byte{} []byte{}}為一組字符串?在這種情況下,我想得到兩個(gè)字符串Hello和World。package mainimport (    "fmt"    "github.com/garyburd/redigo/redis")func main() {    c, err := redis.Dial("tcp", ":6379")    defer c.Close()    if err != nil {        fmt.Println(err)    }    c.Send("SADD", "myset", "Hello")    c.Send("SADD", "myset", "World")    c.Flush()    c.Receive()    c.Receive()    err = c.Send("SMEMBERS", "myset")    if err != nil {        fmt.Println(err)    }    c.Flush()    // both give the same return value!?!?    // reply, err := c.Receive()    reply, err := redis.MultiBulk(c.Receive())    if err != nil {        fmt.Println(err)    }    fmt.Printf("%#v\n", reply)    // $ go run main.go    // []interface {}{[]byte{0x57, 0x6f, 0x72, 0x6c, 0x64}, []byte{0x48, 0x65, 0x6c, 0x6c, 0x6f}}    // How do I get 'Hello' and 'World' from this data?}
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 245 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)