go使用msgpack
go使用msgpack
// test project main.go package main import ( "fmt" "github.com/vmihailenco/msgpack" ) type ( Player struct { Id int Name string } ) func main() { var s [3]Player = [3]Player{ Player{1, "李白"}, Player{2, "赵四"}, Player{3, "小白"}} fmt.Println(s) b, _ := msgpack.Marshal(s) //序列 fmt.Println(b) var out []Player _ = msgpack.Unmarshal(b, &out) //还原 fmt.Println(out) }
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/15627853.html