Exemple #1
0
// MarshalBinary encodes r to a binary format.
func (r *SeriesKeysResponse) MarshalBinary() ([]byte, error) {
	var pb internal.SeriesKeysResponse

	buf, err := r.SeriesList.MarshalBinary()
	if err != nil {
		return nil, err
	}
	pb.SeriesList = buf

	if r.Err != nil {
		pb.Err = proto.String(r.Err.Error())
	}
	return proto.Marshal(&pb)
}
Exemple #2
0
// UnmarshalBinary decodes data into r.
func (r *SeriesKeysResponse) UnmarshalBinary(data []byte) error {
	var pb internal.SeriesKeysResponse
	if err := proto.Unmarshal(data, &pb); err != nil {
		return err
	}

	if err := r.SeriesList.UnmarshalBinary(pb.GetSeriesList()); err != nil {
		return err
	}

	if pb.Err != nil {
		r.Err = errors.New(pb.GetErr())
	}

	return nil
}