MCPcopy Index your code
hub / github.com/dropbox/godropbox / ParseValue

Method ParseValue

database/binlog/string_fields.go:160–184  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

158}
159
160func (d *stringFieldDescriptor) ParseValue(data []byte) (
161 value interface{},
162 remaining []byte,
163 err error) {
164
165 value, remaining, err = d.parseValue(data)
166 if d.fieldType != mysql_proto.FieldType_STRING || err != nil {
167 return value, remaining, err
168 }
169
170 bytesValue, ok := value.([]byte)
171 if !ok {
172 return value, remaining, nil
173 }
174
175 if len(bytesValue) < d.maxLength {
176 // NOTE: We have to allocate a new copy instead of padding it in place
177 // since it is a slice pointing to same backing array as remaining.
178 newBytesValue := bytes.Repeat([]byte("\x00"), d.maxLength)
179 copy(newBytesValue, bytesValue)
180 bytesValue = newBytesValue
181 }
182
183 return bytesValue, remaining, nil
184}
185
186//
187// blobFieldDescriptor --------------------------------------------------------

Callers

nothing calls this directly

Calls 1

parseValueMethod · 0.80

Tested by

no test coverage detected