Encapsulate Insert and Delete into specific structs (#1224)

Signed-off-by: tison <wander4096@gmail.com>
This commit is contained in:
tison 2024-04-21 21:13:18 +08:00 committed by GitHub
parent d2c2b15f9e
commit bf89b7d808
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 187 additions and 147 deletions

View file

@ -7082,7 +7082,7 @@ impl<'a> Parser<'a> {
None
};
Ok(Statement::Delete {
Ok(Statement::Delete(Delete {
tables,
from: if with_from_keyword {
FromTable::WithFromKeyword(from)
@ -7094,7 +7094,7 @@ impl<'a> Parser<'a> {
returning,
order_by,
limit,
})
}))
}
// KILL [CONNECTION | QUERY | MUTATION] processlist_id
@ -8658,7 +8658,7 @@ impl<'a> Parser<'a> {
}
let insert = &mut self.parse_insert()?;
if let Statement::Insert { replace_into, .. } = insert {
if let Statement::Insert(Insert { replace_into, .. }) = insert {
*replace_into = true;
}
@ -8826,7 +8826,7 @@ impl<'a> Parser<'a> {
None
};
Ok(Statement::Insert {
Ok(Statement::Insert(Insert {
or,
table_name,
table_alias,
@ -8843,7 +8843,7 @@ impl<'a> Parser<'a> {
replace_into,
priority,
insert_alias,
})
}))
}
}