Skip to content

Commit 0088796

Browse files
committed
provide typed string
1 parent 01ff6c4 commit 0088796

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ast/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ pub enum Expr {
205205
Nested(Box<Expr>),
206206
/// A literal value, such as string, number, date or NULL
207207
Value(Value),
208+
/// A structure containing a `String` as well as an associated data type.
209+
TypedString { data_type: DataType, value: String },
208210
/// Scalar function call e.g. `LEFT(foo, 5)`
209211
Function(Function),
210212
/// `CASE [<operand>] WHEN <condition> THEN <result> ... [ELSE <result>] END`
@@ -279,6 +281,10 @@ impl fmt::Display for Expr {
279281
Expr::Collate { expr, collation } => write!(f, "{} COLLATE {}", expr, collation),
280282
Expr::Nested(ast) => write!(f, "({})", ast),
281283
Expr::Value(v) => write!(f, "{}", v),
284+
Expr::TypedString { data_type, value } => {
285+
write!(f, "{}", data_type)?;
286+
write!(f, " '{}'", &value::escape_single_quote_string(value))
287+
}
282288
Expr::Function(fun) => write!(f, "{}", fun),
283289
Expr::Case {
284290
operand,

0 commit comments

Comments
 (0)