-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
65 changed files
with
1,265 additions
and
1,102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use nom::branch::alt; | ||
use nom::bytes::complete::{tag, tag_no_case}; | ||
use nom::character::complete::multispace0; | ||
use nom::combinator::{map, opt}; | ||
use nom::sequence::tuple; | ||
use nom::IResult; | ||
|
||
use base::ParseSQLError; | ||
|
||
/// ALGORITHM [=] {DEFAULT | INSTANT | INPLACE | COPY} | ||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] | ||
pub enum AlgorithmType { | ||
Instant, // alter table only | ||
Default, | ||
Inplace, | ||
Copy, | ||
} | ||
|
||
impl AlgorithmType { | ||
/// algorithm_option: | ||
/// ALGORITHM [=] {DEFAULT | INSTANT | INPLACE | COPY} | ||
pub fn parse(i: &str) -> IResult<&str, AlgorithmType, ParseSQLError<&str>> { | ||
map( | ||
tuple(( | ||
tag_no_case("ALGORITHM"), | ||
multispace0, | ||
opt(tag("=")), | ||
multispace0, | ||
alt(( | ||
map(tag_no_case("DEFAULT"), |_| AlgorithmType::Default), | ||
map(tag_no_case("INSTANT"), |_| AlgorithmType::Instant), | ||
map(tag_no_case("INPLACE"), |_| AlgorithmType::Inplace), | ||
map(tag_no_case("COPY"), |_| AlgorithmType::Copy), | ||
)), | ||
)), | ||
|x| x.4, | ||
)(i) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// `[CONSTRAINT [symbol]] CHECK (expr) [[NOT] ENFORCED]` | ||
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)] | ||
pub struct CheckConstraintDefinition { | ||
pub symbol: Option<String>, | ||
pub expr: String, | ||
pub enforced: bool, | ||
} |
Oops, something went wrong.