Example #1
0
func _Set_Binary_Read(s wire.ValueList) ([][]byte, error) {
	if s.ValueType() != wire.TBinary {
		return nil, nil
	}
	o := make([][]byte, 0, s.Size())
	err := s.ForEach(func(x wire.Value) error {
		i, err := x.GetBinary(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	s.Close()
	return o, err
}
Example #2
0
func _List_Event_Read(l wire.ValueList) ([]*Event, error) {
	if l.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make([]*Event, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _Event_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #3
0
func _Set_Frame_Read(s wire.ValueList) ([]*structs.Frame, error) {
	if s.ValueType() != wire.TStruct {
		return nil, nil
	}
	o := make([]*structs.Frame, 0, s.Size())
	err := s.ForEach(func(x wire.Value) error {
		i, err := _Frame_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	s.Close()
	return o, err
}
Example #4
0
func _Set_I64_Read(s wire.ValueList) (map[int64]struct{}, error) {
	if s.ValueType() != wire.TI64 {
		return nil, nil
	}
	o := make(map[int64]struct{}, s.Size())
	err := s.ForEach(func(x wire.Value) error {
		i, err := x.GetI64(), error(nil)
		if err != nil {
			return err
		}
		o[i] = struct{}{}
		return nil
	})
	s.Close()
	return o, err
}
Example #5
0
func _List_String_Read(l wire.ValueList) ([]string, error) {
	if l.ValueType() != wire.TBinary {
		return nil, nil
	}
	o := make([]string, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := x.GetString(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #6
0
func _Set_Map_String_String_Read(s wire.ValueList) ([]map[string]string, error) {
	if s.ValueType() != wire.TMap {
		return nil, nil
	}
	o := make([]map[string]string, 0, s.Size())
	err := s.ForEach(func(x wire.Value) error {
		i, err := _Map_String_String_Read(x.GetMap())
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	s.Close()
	return o, err
}
Example #7
0
func _List_Map_I32_I32_Read(l wire.ValueList) ([]map[int32]int32, error) {
	if l.ValueType() != wire.TMap {
		return nil, nil
	}
	o := make([]map[int32]int32, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _Map_I32_I32_Read(x.GetMap())
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #8
0
func _Set_String_Read(s wire.ValueList) (map[string]struct{}, error) {
	if s.ValueType() != wire.TBinary {
		return nil, nil
	}
	o := make(map[string]struct{}, s.Size())
	err := s.ForEach(func(x wire.Value) error {
		i, err := x.GetString(), error(nil)
		if err != nil {
			return err
		}
		o[i] = struct{}{}
		return nil
	})
	s.Close()
	return o, err
}
Example #9
0
func _List_I32_Read(l wire.ValueList) ([]int32, error) {
	if l.ValueType() != wire.TI32 {
		return nil, nil
	}
	o := make([]int32, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := x.GetI32(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #10
0
func _List_Set_I32_Read(l wire.ValueList) ([]map[int32]struct{}, error) {
	if l.ValueType() != wire.TSet {
		return nil, nil
	}
	o := make([]map[int32]struct{}, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _Set_I32_Read(x.GetSet())
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #11
0
func _Set_EnumWithValues_Read(s wire.ValueList) (map[enums.EnumWithValues]struct{}, error) {
	if s.ValueType() != wire.TI32 {
		return nil, nil
	}
	o := make(map[enums.EnumWithValues]struct{}, s.Size())
	err := s.ForEach(func(x wire.Value) error {
		i, err := _EnumWithValues_Read(x)
		if err != nil {
			return err
		}
		o[i] = struct{}{}
		return nil
	})
	s.Close()
	return o, err
}
Example #12
0
func _List_EnumDefault_Read(l wire.ValueList) ([]enums.EnumDefault, error) {
	if l.ValueType() != wire.TI32 {
		return nil, nil
	}
	o := make([]enums.EnumDefault, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _EnumDefault_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #13
0
func _List_Double_Read(l wire.ValueList) ([]float64, error) {
	if l.ValueType() != wire.TDouble {
		return nil, nil
	}
	o := make([]float64, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := x.GetDouble(), error(nil)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
func _List_Key_Read(l wire.ValueList) ([]Key, error) {
	if l.ValueType() != wire.TBinary {
		return nil, nil
	}
	o := make([]Key, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _Key_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #15
0
func _List_ServiceID_Read(l wire.ValueList) ([]ServiceID, error) {
	if l.ValueType() != wire.TI32 {
		return nil, nil
	}
	o := make([]ServiceID, 0, l.Size())
	err := l.ForEach(func(x wire.Value) error {
		i, err := _ServiceID_Read(x)
		if err != nil {
			return err
		}
		o = append(o, i)
		return nil
	})
	l.Close()
	return o, err
}
Example #16
0
func (bw *Writer) writeList(l wire.ValueList) error {
	// vtype:1
	if err := bw.writeByte(byte(l.ValueType())); err != nil {
		return err
	}

	// length:4
	if err := bw.writeInt32(int32(l.Size())); err != nil {
		return err
	}

	return l.ForEach(bw.writeValue)
}