{"modulePath":"github.com/cockroachdb/cockroachdb-parser","version":"v0.25.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package lex\n\n## Variables\n\n```go\nvar BytesEncodeFormat_name = map[int32]string{\n\t0: \"BytesEncodeHex\",\n\t1: \"BytesEncodeEscape\",\n\t2: \"BytesEncodeBase64\",\n}\n```\n\n```go\nvar BytesEncodeFormat_value = map[string]int32{\n\t\"BytesEncodeHex\":    0,\n\t\"BytesEncodeEscape\": 1,\n\t\"BytesEncodeBase64\": 2,\n}\n```\n\n## Functions\n\n```go\nfunc DecodeRawBytesToByteArray(data []byte, be BytesEncodeFormat) ([]byte, error)\n```\nDecodeRawBytesToByteArray converts raw bytes to a SQL-level byte array according to the encoding specification in \"be\". When using the Hex format, the caller is responsible for skipping the \"\\\\x\" prefix, if any. See DecodeRawBytesToByteArrayAuto() below for an alternative. If no conversion is necessary the input is returned, callers should not assume a copy is made.\n\n```go\nfunc DecodeRawBytesToByteArrayAuto(data []byte) ([]byte, error)\n```\nDecodeRawBytesToByteArrayAuto detects which format to use with DecodeRawBytesToByteArray(). It only supports hex (\"\\\\x\" prefix) and escape.\n\n```go\nfunc EncodeByteArrayToRawBytes(data string, be BytesEncodeFormat, skipHexPrefix bool) string\n```\nEncodeByteArrayToRawBytes converts a SQL-level byte array into raw bytes according to the encoding specification in \"be\". If the skipHexPrefix argument is set, the hexadecimal encoding does not prefix the output with \"\\\\x\". This is suitable e.g. for the encode() built-in.\n\n```go\nfunc EncodeLocaleName(buf *bytes.Buffer, s string)\n```\nEncodeLocaleName writes the locale identifier in s to buf. Any dash characters are mapped to underscore characters. Underscore characters do not need to be quoted, and they are considered equivalent to dash characters by the CLDR standard: [http://cldr.unicode.org/](http://cldr.unicode.org/).\n\n```go\nfunc LocaleNamesAreEqual(a, b string) bool\n```\nLocaleNamesAreEqual checks for equality of two locale names. The comparison is case-insensitive and treats '-' and '\\_' as the same.\n\n```go\nfunc NormalizeLocaleName(s string) string\n```\nNormalizeLocaleName returns a normalized locale identifier based on s. The case of the locale is normalized and any dash characters are mapped to underscore characters.\n\n## Types\n\n```go\ntype BytesEncodeFormat int32\n```\nBytesEncodeFormat is the configuration for bytes to string conversions.\n\n```go\nconst (\n\t// BytesEncodeHex uses the hex format: e'abc\\n'::BYTES::STRING -\u003e '\\x61626312'.\n\t// This is the default, for compatibility with PostgreSQL.\n\tBytesEncodeHex BytesEncodeFormat = 0\n\t// BytesEncodeEscape uses the escaped format: e'abc\\n'::BYTES::STRING -\u003e 'abc\\012'.\n\tBytesEncodeEscape BytesEncodeFormat = 1\n\t// BytesEncodeBase64 uses base64 encoding.\n\tBytesEncodeBase64 BytesEncodeFormat = 2\n)\n```\n\n```go\nfunc BytesEncodeFormatFromString(val string) (_ BytesEncodeFormat, ok bool)\n```\nBytesEncodeFormatFromString converts a string into a BytesEncodeFormat.\n\n```go\nfunc (BytesEncodeFormat) EnumDescriptor() ([]byte, []int)\n```\n\n```go\nfunc (f BytesEncodeFormat) String() string\n```\n\n","path":"github.com/cockroachdb/cockroachdb-parser/pkg/sql/lex","name":"lex","synopsis":"","isRedistributable":true}
