UInt32Values converts the lazily-decoded field data into a []uint32. See the [FieldData] docs for more specific details about interpreting lazily-decoded data.
()
| 181 | // |
| 182 | // See the [FieldData] docs for more specific details about interpreting lazily-decoded data. |
| 183 | func (fd *FieldData) UInt32Values() ([]uint32, error) { |
| 184 | if fd == nil || len(fd.data) == 0 { |
| 185 | return nil, ErrTagNotFound |
| 186 | } |
| 187 | s, err := sliceValue(fd, csproto.WireTypeVarint, fd.uint32Slice, func(data []byte) (uint32, int, error) { |
| 188 | value, n, err := csproto.DecodeVarint(data) |
| 189 | if err != nil { |
| 190 | return 0, 0, err |
| 191 | } |
| 192 | if value > math.MaxUint32 { |
| 193 | return 0, 0, csproto.ErrValueOverflow |
| 194 | } |
| 195 | return uint32(value), n, nil |
| 196 | }) |
| 197 | if fd.unsafe { |
| 198 | fd.maxCap = max(fd.maxCap, cap(s)) |
| 199 | fd.uint32Slice = s |
| 200 | } |
| 201 | return s, err |
| 202 | } |
| 203 | |
| 204 | // Int32Value converts the lazily-decoded field data into an int32. |
| 205 | // |