graup commented on code in PR #1679:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1679#discussion_r1927082163
##########
src/ast/value.rs:
##########
@@ -97,6 +97,32 @@ pub enum Value {
Placeholder(String),
}
+impl Into<String> for Value {
+ fn into(self) -> String {
+ match self {
+ Value::SingleQuotedString(s) => s,
+ Value::TripleSingleQuotedString(s) => s,
+ Value::TripleDoubleQuotedString(s) => s,
+ Value::EscapedStringLiteral(s) => s,
+ Value::UnicodeStringLiteral(s) => s,
+ Value::SingleQuotedByteStringLiteral(s) => s,
+ Value::DoubleQuotedByteStringLiteral(s) => s,
+ Value::TripleSingleQuotedByteStringLiteral(s) => s,
+ Value::TripleDoubleQuotedByteStringLiteral(s) => s,
+ Value::SingleQuotedRawStringLiteral(s) => s,
+ Value::DoubleQuotedRawStringLiteral(s) => s,
+ Value::TripleSingleQuotedRawStringLiteral(s) => s,
+ Value::TripleDoubleQuotedRawStringLiteral(s) => s,
+ Value::NationalStringLiteral(s) => s,
+ Value::HexStringLiteral(s) => s,
+ Value::DoubleQuotedString(s) => s,
+ Value::Placeholder(s) => s,
+ Value::DollarQuotedString(s) => s.value,
+ _ => panic!("not a string value"),
Review Comment:
Not sure about this one. This panics for Number, Boolean, Null. Should be
safe if users only access String values where they are supposed to be?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]