MCPcopy Create free account
hub / github.com/apecloud/myduckserver / Encode

Function Encode

charset/charset.go:75–83  ·  view source on GitHub ↗
(id sql.CharacterSetID, utf8 string)

Source from the content-addressed store, hash-verified

73}
74
75func Encode(id sql.CharacterSetID, utf8 string) (string, error) {
76 en, err := getEncoding(id)
77 if err != nil {
78 return utf8, err
79 } else if en == encoding.Nop { // allocation-free fast path
80 return utf8, nil
81 }
82 return en.NewEncoder().String(utf8)
83}
84
85func Decode(id sql.CharacterSetID, encoded string) (string, error) {
86 en, err := getEncoding(id)

Callers 2

NextMethod · 0.92
TestEncodeFunction · 0.85

Calls 2

getEncodingFunction · 0.85
StringMethod · 0.45

Tested by 1

TestEncodeFunction · 0.68