Merge branch 'main' into optimize-operation
This commit is contained in:
commit
80c4ff220e
1 changed files with 10 additions and 5 deletions
|
|
@ -100,17 +100,17 @@ pub fn parse_string(input: &str) -> IResult<&str, Value> {
|
|||
Ok((input, Value::Indexable(IndexableValue::String(value))))
|
||||
}
|
||||
|
||||
fn parse_uuid(input: &str) -> IResult<&str, Value> {
|
||||
// TODO: make it actually uuid
|
||||
u64(input).map(|(input, v)| {
|
||||
pub fn parse_uuid(input: &str) -> IResult<&str, Value> {
|
||||
let (input, value) = pair(char('u'), u64)(input).map(|(input, (_, v))| {
|
||||
(input, Value::Indexable(IndexableValue::Uuid(v)))
|
||||
})
|
||||
})?;
|
||||
Ok((input, value))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use minisql::type_system::{IndexableValue, Value};
|
||||
use crate::parsing::literal::{parse_db_value, parse_string};
|
||||
use crate::parsing::literal::{parse_db_value, parse_string, parse_uuid};
|
||||
|
||||
|
||||
#[test]
|
||||
|
|
@ -161,4 +161,9 @@ mod tests {
|
|||
fn test_parse_int() {
|
||||
assert_eq!(parse_db_value("5134616"), Ok(("", Value::Indexable(IndexableValue::Int(5134616)))));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_parse_uuid() {
|
||||
assert_eq!(parse_uuid("u131515"), Ok(("", Value::Indexable(IndexableValue::Uuid(131515)))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue