MCPcopy Create free account
hub / github.com/CrowdStrike/csproto / BoolValues

Method BoolValues

lazyproto/fielddata.go:85–101  ·  view source on GitHub ↗

BoolValues converts the lazily-decoded field data into a []bool. Since Protobuf encodes boolean values as integers, any varint-encoded integer value is valid. A value of zero is treated as false and any non-zero value is treated as true. See the [FieldData] docs for more specific details about int

()

Source from the content-addressed store, hash-verified

83//
84// See the [FieldData] docs for more specific details about interpreting lazily-decoded data.
85func (fd *FieldData) BoolValues() ([]bool, error) {
86 if fd == nil || len(fd.data) == 0 {
87 return nil, ErrTagNotFound
88 }
89 s, err := sliceValue(fd, csproto.WireTypeVarint, fd.boolSlice, func(data []byte) (bool, int, error) {
90 v, n, err := csproto.DecodeVarint(data)
91 if err != nil {
92 return false, 0, err
93 }
94 return v != 0, n, nil
95 })
96 if fd.unsafe {
97 fd.maxCap = max(fd.maxCap, cap(s))
98 fd.boolSlice = s
99 }
100 return s, err
101}
102
103// StringValue converts the lazily-decoded field data into a string.
104//

Callers 2

FuzzBoolsFunction · 0.45
TestBooleanFieldDataFunction · 0.45

Calls 2

DecodeVarintFunction · 0.92
sliceValueFunction · 0.85

Tested by 2

FuzzBoolsFunction · 0.36
TestBooleanFieldDataFunction · 0.36