本文整理汇总了Golang中go/uber/org/thriftrw/wire.MapItemList类的典型用法代码示例。如果您正苦于以下问题:Golang MapItemList类的具体用法?Golang MapItemList怎么用?Golang MapItemList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MapItemList类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: _Map_Point_Point_Read
func _Map_Point_Point_Read(m wire.MapItemList) ([]struct {
Key *structs.Point
Value *structs.Point
}, error) {
if m.KeyType() != wire.TStruct {
return nil, nil
}
if m.ValueType() != wire.TStruct {
return nil, nil
}
o := make([]struct {
Key *structs.Point
Value *structs.Point
}, 0, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := _Point_Read(x.Key)
if err != nil {
return err
}
v, err := _Point_Read(x.Value)
if err != nil {
return err
}
o = append(o, struct {
Key *structs.Point
Value *structs.Point
}{k, v})
return nil
})
m.Close()
return o, err
}
示例2: _Map_Map_String_I32_I64_Read
func _Map_Map_String_I32_I64_Read(m wire.MapItemList) ([]struct {
Key map[string]int32
Value int64
}, error) {
if m.KeyType() != wire.TMap {
return nil, nil
}
if m.ValueType() != wire.TI64 {
return nil, nil
}
o := make([]struct {
Key map[string]int32
Value int64
}, 0, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := _Map_String_I32_Read(x.Key.GetMap())
if err != nil {
return err
}
v, err := x.Value.GetI64(), error(nil)
if err != nil {
return err
}
o = append(o, struct {
Key map[string]int32
Value int64
}{k, v})
return nil
})
m.Close()
return o, err
}
示例3: _Map_List_I32_Set_I64_Read
func _Map_List_I32_Set_I64_Read(m wire.MapItemList) ([]struct {
Key []int32
Value map[int64]struct{}
}, error) {
if m.KeyType() != wire.TList {
return nil, nil
}
if m.ValueType() != wire.TSet {
return nil, nil
}
o := make([]struct {
Key []int32
Value map[int64]struct{}
}, 0, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := _List_I32_Read(x.Key.GetList())
if err != nil {
return err
}
v, err := _Set_I64_Read(x.Value.GetSet())
if err != nil {
return err
}
o = append(o, struct {
Key []int32
Value map[int64]struct{}
}{k, v})
return nil
})
m.Close()
return o, err
}
示例4: _Map_Binary_String_Read
func _Map_Binary_String_Read(m wire.MapItemList) ([]struct {
Key []byte
Value string
}, error) {
if m.KeyType() != wire.TBinary {
return nil, nil
}
if m.ValueType() != wire.TBinary {
return nil, nil
}
o := make([]struct {
Key []byte
Value string
}, 0, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := x.Key.GetBinary(), error(nil)
if err != nil {
return err
}
v, err := x.Value.GetString(), error(nil)
if err != nil {
return err
}
o = append(o, struct {
Key []byte
Value string
}{k, v})
return nil
})
m.Close()
return o, err
}
示例5: _Map_I16_String_Read
func _Map_I16_String_Read(m wire.MapItemList) (map[int16]string, error) {
if m.KeyType() != wire.TI16 {
return nil, nil
}
if m.ValueType() != wire.TBinary {
return nil, nil
}
o := make(map[int16]string, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := x.Key.GetI16(), error(nil)
if err != nil {
return err
}
v, err := x.Value.GetString(), error(nil)
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例6: _Map_UserId_Map_Numberz_Insanity_Read
func _Map_UserId_Map_Numberz_Insanity_Read(m wire.MapItemList) (map[UserId]map[Numberz]*Insanity, error) {
if m.KeyType() != wire.TI64 {
return nil, nil
}
if m.ValueType() != wire.TMap {
return nil, nil
}
o := make(map[UserId]map[Numberz]*Insanity, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := _UserId_Read(x.Key)
if err != nil {
return err
}
v, err := _Map_Numberz_Insanity_Read(x.Value.GetMap())
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例7: _Map_Numberz_Insanity_Read
func _Map_Numberz_Insanity_Read(m wire.MapItemList) (map[Numberz]*Insanity, error) {
if m.KeyType() != wire.TI32 {
return nil, nil
}
if m.ValueType() != wire.TStruct {
return nil, nil
}
o := make(map[Numberz]*Insanity, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := _Numberz_Read(x.Key)
if err != nil {
return err
}
v, err := _Insanity_Read(x.Value)
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例8: _Map_I32_I32_Read
func _Map_I32_I32_Read(m wire.MapItemList) (map[int32]int32, error) {
if m.KeyType() != wire.TI32 {
return nil, nil
}
if m.ValueType() != wire.TI32 {
return nil, nil
}
o := make(map[int32]int32, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := x.Key.GetI32(), error(nil)
if err != nil {
return err
}
v, err := x.Value.GetI32(), error(nil)
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例9: _Map_I64_Double_Read
func _Map_I64_Double_Read(m wire.MapItemList) (map[int64]float64, error) {
if m.KeyType() != wire.TI64 {
return nil, nil
}
if m.ValueType() != wire.TDouble {
return nil, nil
}
o := make(map[int64]float64, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := x.Key.GetI64(), error(nil)
if err != nil {
return err
}
v, err := x.Value.GetDouble(), error(nil)
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例10: _Map_String_ArbitraryValue_Read
func _Map_String_ArbitraryValue_Read(m wire.MapItemList) (map[string]*ArbitraryValue, error) {
if m.KeyType() != wire.TBinary {
return nil, nil
}
if m.ValueType() != wire.TStruct {
return nil, nil
}
o := make(map[string]*ArbitraryValue, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := x.Key.GetString(), error(nil)
if err != nil {
return err
}
v, err := _ArbitraryValue_Read(x.Value)
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例11: _Map_ModuleID_Module_Read
func _Map_ModuleID_Module_Read(m wire.MapItemList) (map[ModuleID]*Module, error) {
if m.KeyType() != wire.TI32 {
return nil, nil
}
if m.ValueType() != wire.TStruct {
return nil, nil
}
o := make(map[ModuleID]*Module, m.Size())
err := m.ForEach(func(x wire.MapItem) error {
k, err := _ModuleID_Read(x.Key)
if err != nil {
return err
}
v, err := _Module_Read(x.Value)
if err != nil {
return err
}
o[k] = v
return nil
})
m.Close()
return o, err
}
示例12: writeMap
func (bw *Writer) writeMap(m wire.MapItemList) error {
// ktype:1
if err := bw.writeByte(byte(m.KeyType())); err != nil {
return err
}
// vtype:1
if err := bw.writeByte(byte(m.ValueType())); err != nil {
return err
}
// length:4
if err := bw.writeInt32(int32(m.Size())); err != nil {
return err
}
return m.ForEach(bw.writeMapItem)
}