MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / ParseDByte

Function ParseDByte

pkg/sql/sem/tree/datum.go:370–376  ·  view source on GitHub ↗

ParseDByte parses a string representation of hex encoded binary data. It supports both the hex format, with "\x" followed by a string of hexadecimal digits (the "\x" prefix occurs just once at the beginning), and the escaped format, which supports "\\" and octal escapes.

(s string)

Source from the content-addressed store, hash-verified

368// the beginning), and the escaped format, which supports "\\" and
369// octal escapes.
370func ParseDByte(s string) (*DBytes, error) {
371 res, err := lex.DecodeRawBytesToByteArrayAuto(encoding.UnsafeConvertStringToBytes(s))
372 if err != nil {
373 return nil, MakeParseError(s, types.Bytes, err)
374 }
375 return NewDBytes(DBytes(encoding.UnsafeConvertBytesToString(res))), nil
376}
377
378// ParseDUuidFromString parses and returns the *DUuid Datum value represented
379// by the provided input string, or an error.

Callers 2

ParseAndRequireStringFunction · 0.85
ResolveAsTypeMethod · 0.85

Calls 6

MakeParseErrorFunction · 0.85
NewDBytesFunction · 0.85
DBytesTypeAlias · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…