MCPcopy
hub / github.com/redis/go-redis / readReply

Method readReply

timeseries_commands.go:824–867  ·  view source on GitHub ↗
(rd *proto.Reader)

Source from the content-addressed store, hash-verified

822}
823
824func (cmd *TSTimestampValueSliceCmd) readReply(rd *proto.Reader) (err error) {
825 n, err := rd.ReadArrayLen()
826 if err != nil {
827 return err
828 }
829 cmd.val = make([]TSTimestampValue, n)
830 for i := 0; i < n; i++ {
831 itemLen, err := rd.ReadArrayLen()
832 if err != nil {
833 return err
834 }
835
836 timestamp, err := rd.ReadInt()
837 if err != nil {
838 return err
839 }
840 cmd.val[i].Timestamp = timestamp
841 if itemLen == 2 {
842 value, err := rd.ReadString()
843 if err != nil {
844 return err
845 }
846 cmd.val[i].Value, err = util.ParseStringToFloat(value)
847 if err != nil {
848 return err
849 }
850 continue
851 }
852
853 cmd.val[i].Values = make([]float64, itemLen-1)
854 for j := 0; j < itemLen-1; j++ {
855 value, err := rd.ReadString()
856 if err != nil {
857 return err
858 }
859 cmd.val[i].Values[j], err = util.ParseStringToFloat(value)
860 if err != nil {
861 return err
862 }
863 }
864 }
865
866 return nil
867}
868
869func (cmd *TSTimestampValueSliceCmd) Clone() Cmder {
870 var val []TSTimestampValue

Callers

nothing calls this directly

Calls 4

ParseStringToFloatFunction · 0.92
ReadArrayLenMethod · 0.80
ReadIntMethod · 0.80
ReadStringMethod · 0.80

Tested by

no test coverage detected