-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
types: add ToString
method for HexLiteral
and BitLiteral
#11029
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11029 +/- ##
==============================================
- Coverage 81.1069% 80.961% -0.146%
==============================================
Files 419 418 -1
Lines 89615 89259 -356
==============================================
- Hits 72684 72265 -419
- Misses 11704 11757 +53
- Partials 5227 5237 +10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
types/binary_literal.go
Outdated
@@ -183,6 +183,11 @@ func NewBitLiteral(s string) (BitLiteral, error) { | |||
return BitLiteral(b), nil | |||
} | |||
|
|||
// ToString implement ast.BinaryLiteral interface | |||
func (b BitLiteral) ToString() string { | |||
return string(b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return string(b) | |
return BinaryLiteral(b).ToString() |
to ensure the implementations are the same.
types/binary_literal.go
Outdated
|
||
// ToString implement ast.BinaryLiteral interface | ||
func (b HexLiteral) ToString() string { | ||
return string(b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return string(b) | |
return BinaryLiteral(b).ToString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/run-all-tests |
What problem does this PR solve?
pingcap/parser#365 support hex and binary expression in
LOAD DATA
.But import an new interface
ast.BinaryLiteral
which requireHexLiteral
andBinaryLiteral
implementToString
methodWhat is changed and how it works?
add
ToString
method forHexLiteral
andBitLiteral
Check List
Tests
Code changes
Side effects
Related changes