Documentation ¶
Index ¶
- Variables
- func DecodeRawBytesToByteArray(data string, be BytesEncodeFormat) ([]byte, error)
- func DecodeRawBytesToByteArrayAuto(data []byte) ([]byte, error)
- func EncodeByteArrayToRawBytes(data string, be BytesEncodeFormat, skipHexPrefix bool) string
- func EncodeLocaleName(buf *bytes.Buffer, s string)
- func LocaleNamesAreEqual(a, b string) bool
- func NormalizeLocaleName(s string) string
- type BytesEncodeFormat
Constants ¶
This section is empty.
Variables ¶
var BytesEncodeFormat_name = map[int32]string{
0: "BytesEncodeHex",
1: "BytesEncodeEscape",
2: "BytesEncodeBase64",
}
var BytesEncodeFormat_value = map[string]int32{
"BytesEncodeHex": 0,
"BytesEncodeEscape": 1,
"BytesEncodeBase64": 2,
}
Functions ¶
func DecodeRawBytesToByteArray ¶
func DecodeRawBytesToByteArray(data string, be BytesEncodeFormat) ([]byte, error)
DecodeRawBytesToByteArray 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.
func DecodeRawBytesToByteArrayAuto ¶
DecodeRawBytesToByteArrayAuto detects which format to use with DecodeRawBytesToByteArray(). It only supports hex ("\x" prefix) and escape.
func EncodeByteArrayToRawBytes ¶
func EncodeByteArrayToRawBytes(data string, be BytesEncodeFormat, skipHexPrefix bool) string
EncodeByteArrayToRawBytes 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.
func EncodeLocaleName ¶
EncodeLocaleName 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/.
func LocaleNamesAreEqual ¶
LocaleNamesAreEqual checks for equality of two locale names. The comparison is case-insensitive and treats '-' and '_' as the same.
func NormalizeLocaleName ¶
NormalizeLocaleName returns a normalized locale identifier based on s. The case of the locale is normalized and any dash characters are mapped to underscore characters.
Types ¶
type BytesEncodeFormat ¶
type BytesEncodeFormat int32
BytesEncodeFormat is the configuration for bytes to string conversions.
const ( // BytesEncodeHex uses the hex format: e'abc\n'::BYTES::STRING -> '\x61626312'. // This is the default, for compatibility with PostgreSQL. BytesEncodeHex BytesEncodeFormat = 0 // BytesEncodeEscape uses the escaped format: e'abc\n'::BYTES::STRING -> 'abc\012'. BytesEncodeEscape BytesEncodeFormat = 1 // BytesEncodeBase64 uses base64 encoding. BytesEncodeBase64 BytesEncodeFormat = 2 )
func BytesEncodeFormatFromString ¶
func BytesEncodeFormatFromString(val string) (_ BytesEncodeFormat, ok bool)
BytesEncodeFormatFromString converts a string into a BytesEncodeFormat.
func (BytesEncodeFormat) EnumDescriptor ¶
func (BytesEncodeFormat) EnumDescriptor() ([]byte, []int)
func (BytesEncodeFormat) String ¶
func (f BytesEncodeFormat) String() string