1313
1414//go:build !codes
1515
16- package test_driver
16+ package ast
1717
1818import (
1919 "bytes"
@@ -155,12 +155,12 @@ func (d *Datum) SetNull() {
155155}
156156
157157// GetBinaryLiteral gets Bit value
158- func (d * Datum ) GetBinaryLiteral () BinaryLiteral {
158+ func (d * Datum ) GetBinaryLiteral () BinaryLit {
159159 return d .b
160160}
161161
162162// SetBinaryLiteral sets Bit value
163- func (d * Datum ) SetBinaryLiteral (b BinaryLiteral ) {
163+ func (d * Datum ) SetBinaryLiteral (b BinaryLit ) {
164164 d .k = KindBinaryLiteral
165165 d .b = b
166166}
@@ -227,12 +227,12 @@ func (d *Datum) SetValue(val any) {
227227 d .SetBytes (x )
228228 case * MyDecimal :
229229 d .SetMysqlDecimal (x )
230- case BinaryLiteral :
230+ case BinaryLit :
231231 d .SetBinaryLiteral (x )
232- case BitLiteral : // Store as BinaryLiteral for Bit and Hex literals
233- d .SetBinaryLiteral (BinaryLiteral (x ))
232+ case BitLiteral : // Store as BinaryLit for Bit and Hex literals
233+ d .SetBinaryLiteral (BinaryLit (x ))
234234 case HexLiteral :
235- d .SetBinaryLiteral (BinaryLiteral (x ))
235+ d .SetBinaryLiteral (BinaryLit (x ))
236236 default :
237237 d .SetInterface (x )
238238 }
@@ -270,33 +270,33 @@ func MakeDatums(args ...any) []Datum {
270270 return datums
271271}
272272
273- // BinaryLiteral is the internal type for storing bit / hex literal type.
274- type BinaryLiteral []byte
273+ // BinaryLit is the internal type for storing bit / hex literal type.
274+ type BinaryLit []byte
275275
276276// BitLiteral is the bit literal type.
277- type BitLiteral BinaryLiteral
277+ type BitLiteral BinaryLit
278278
279279// HexLiteral is the hex literal type.
280- type HexLiteral BinaryLiteral
280+ type HexLiteral BinaryLit
281281
282- // ZeroBinaryLiteral is a BinaryLiteral literal with zero value.
283- var ZeroBinaryLiteral = BinaryLiteral {}
282+ // ZeroBinaryLit is a BinaryLit literal with zero value.
283+ var ZeroBinaryLit = BinaryLit {}
284284
285285// String implements fmt.Stringer interface.
286- func (b BinaryLiteral ) String () string {
286+ func (b BinaryLit ) String () string {
287287 if len (b ) == 0 {
288288 return ""
289289 }
290290 return "0x" + hex .EncodeToString (b )
291291}
292292
293293// ToString returns the string representation for the literal.
294- func (b BinaryLiteral ) ToString () string {
294+ func (b BinaryLit ) ToString () string {
295295 return string (b )
296296}
297297
298298// ToBitLiteralString returns the bit literal representation for the literal.
299- func (b BinaryLiteral ) ToBitLiteralString (trimLeadingZero bool ) string {
299+ func (b BinaryLit ) ToBitLiteralString (trimLeadingZero bool ) string {
300300 if len (b ) == 0 {
301301 return "b''"
302302 }
@@ -317,7 +317,7 @@ func (b BinaryLiteral) ToBitLiteralString(trimLeadingZero bool) string {
317317// ParseBitStr parses bit string.
318318// The string format can be b'val', B'val' or 0bval, val must be 0 or 1.
319319// See https://dev.mysql.com/doc/refman/5.7/en/bit-value-literals.html
320- func ParseBitStr (s string ) (BinaryLiteral , error ) {
320+ func ParseBitStr (s string ) (BinaryLit , error ) {
321321 if len (s ) == 0 {
322322 return nil , fmt .Errorf ("invalid empty string for parsing bit type" )
323323 }
@@ -333,7 +333,7 @@ func ParseBitStr(s string) (BinaryLiteral, error) {
333333 }
334334
335335 if len (s ) == 0 {
336- return ZeroBinaryLiteral , nil
336+ return ZeroBinaryLit , nil
337337 }
338338
339339 alignedLength := (len (s ) + 7 ) &^ 7
@@ -362,14 +362,14 @@ func NewBitLiteral(s string) (BitLiteral, error) {
362362 return BitLiteral (b ), nil
363363}
364364
365- // ToString implement ast. BinaryLiteral interface
365+ // ToString implement BinaryLiteral interface
366366func (b BitLiteral ) ToString () string {
367- return BinaryLiteral (b ).ToString ()
367+ return BinaryLit (b ).ToString ()
368368}
369369
370370// ParseHexStr parses hexadecimal string literal.
371371// See https://dev.mysql.com/doc/refman/5.7/en/hexadecimal-literals.html
372- func ParseHexStr (s string ) (BinaryLiteral , error ) {
372+ func ParseHexStr (s string ) (BinaryLit , error ) {
373373 if len (s ) == 0 {
374374 return nil , fmt .Errorf ("invalid empty string for parsing hexadecimal literal" )
375375 }
@@ -388,7 +388,7 @@ func ParseHexStr(s string) (BinaryLiteral, error) {
388388 }
389389
390390 if len (s ) == 0 {
391- return ZeroBinaryLiteral , nil
391+ return ZeroBinaryLit , nil
392392 }
393393
394394 if len (s )% 2 != 0 {
@@ -410,9 +410,9 @@ func NewHexLiteral(s string) (HexLiteral, error) {
410410 return HexLiteral (h ), nil
411411}
412412
413- // ToString implement ast. BinaryLiteral interface
413+ // ToString implement BinaryLiteral interface
414414func (b HexLiteral ) ToString () string {
415- return BinaryLiteral (b ).ToString ()
415+ return BinaryLit (b ).ToString ()
416416}
417417
418418// SetBinChsClnFlag sets charset, collation as 'binary' and adds binaryFlag to FieldType.
@@ -491,7 +491,7 @@ func DefaultTypeForValue(value any, tp *types.FieldType, charset string, collate
491491 tp .SetDecimal (0 )
492492 tp .AddFlag (mysql .UnsignedFlag )
493493 SetBinChsClnFlag (tp )
494- case BinaryLiteral :
494+ case BinaryLit :
495495 tp .SetType (mysql .TypeBit )
496496 tp .SetFlen (len (x ) * 8 )
497497 tp .SetDecimal (0 )
0 commit comments