Skip to content

Commit 67be33d

Browse files
Finished renaming to ConstraintReferenceMatchKind
1 parent 402ef42 commit 67be33d

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/ast/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,12 @@ pub enum ConstraintReferenceMatchKind {
670670
Simple,
671671
}
672672

673-
impl fmt::Display for MatchKind {
673+
impl fmt::Display for ConstraintReferenceMatchKind {
674674
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
675675
match self {
676-
MatchKind::Full => write!(f, "MATCH FULL"),
677-
MatchKind::Partial => write!(f, "MATCH PARTIAL"),
678-
MatchKind::Simple => write!(f, "MATCH SIMPLE"),
676+
Self::Full => write!(f, "MATCH FULL"),
677+
Self::Partial => write!(f, "MATCH PARTIAL"),
678+
Self::Simple => write!(f, "MATCH SIMPLE"),
679679
}
680680
}
681681
}

src/ast/table_constraints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
use crate::ast::{
2121
display_comma_separated, display_separated, ConstraintCharacteristics, Expr, Ident,
22-
IndexColumn, IndexOption, IndexType, KeyOrIndexDisplay, MatchKind, NullsDistinctOption,
22+
IndexColumn, IndexOption, IndexType, KeyOrIndexDisplay, ConstraintReferenceMatchKind, NullsDistinctOption,
2323
ObjectName, ReferentialAction,
2424
};
2525
use crate::tokenizer::Span;
@@ -206,7 +206,7 @@ pub struct ForeignKeyConstraint {
206206
pub referred_columns: Vec<Ident>,
207207
pub on_delete: Option<ReferentialAction>,
208208
pub on_update: Option<ReferentialAction>,
209-
pub match_kind: Option<MatchKind>,
209+
pub match_kind: Option<ConstraintReferenceMatchKind>,
210210
pub characteristics: Option<ConstraintCharacteristics>,
211211
}
212212

src/parser/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8357,13 +8357,13 @@ impl<'a> Parser<'a> {
83578357
}
83588358
}
83598359

8360-
pub fn parse_match_kind(&mut self) -> Result<MatchKind, ParserError> {
8360+
pub fn parse_match_kind(&mut self) -> Result<ConstraintReferenceMatchKind, ParserError> {
83618361
if self.parse_keyword(Keyword::FULL) {
8362-
Ok(MatchKind::Full)
8362+
Ok(ConstraintReferenceMatchKind::Full)
83638363
} else if self.parse_keyword(Keyword::PARTIAL) {
8364-
Ok(MatchKind::Partial)
8364+
Ok(ConstraintReferenceMatchKind::Partial)
83658365
} else if self.parse_keyword(Keyword::SIMPLE) {
8366-
Ok(MatchKind::Simple)
8366+
Ok(ConstraintReferenceMatchKind::Simple)
83678367
} else {
83688368
self.expected("one of FULL, PARTIAL or SIMPLE", self.peek_token())
83698369
}

tests/sqlparser_postgres.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6663,7 +6663,7 @@ fn parse_foreign_key_match_full() {
66636663
match &columns[0].options[1].option {
66646664
ColumnOption::ForeignKey(constraint) => {
66656665
assert_eq!(constraint.foreign_table.to_string(), "another_table");
6666-
assert_eq!(constraint.match_kind, Some(MatchKind::Full));
6666+
assert_eq!(constraint.match_kind, Some(ConstraintReferenceMatchKind::Full));
66676667
}
66686668
_ => panic!("Expected ColumnOption::ForeignKey"),
66696669
}
@@ -6672,7 +6672,7 @@ fn parse_foreign_key_match_full() {
66726672
match &constraints[0] {
66736673
TableConstraint::ForeignKey(constraint) => {
66746674
assert_eq!(constraint.foreign_table.to_string(), "customers");
6675-
assert_eq!(constraint.match_kind, Some(MatchKind::Full));
6675+
assert_eq!(constraint.match_kind, Some(ConstraintReferenceMatchKind::Full));
66766676
}
66776677
_ => panic!("Expected TableConstraint::ForeignKey"),
66786678
}
@@ -6696,7 +6696,7 @@ fn parse_foreign_key_match_simple() {
66966696
match &columns[0].options[1].option {
66976697
ColumnOption::ForeignKey(constraint) => {
66986698
assert_eq!(constraint.foreign_table.to_string(), "another_table");
6699-
assert_eq!(constraint.match_kind, Some(MatchKind::Simple));
6699+
assert_eq!(constraint.match_kind, Some(ConstraintReferenceMatchKind::Simple));
67006700
}
67016701
_ => panic!("Expected ColumnOption::ForeignKey"),
67026702
}
@@ -6705,7 +6705,7 @@ fn parse_foreign_key_match_simple() {
67056705
match &constraints[0] {
67066706
TableConstraint::ForeignKey(constraint) => {
67076707
assert_eq!(constraint.foreign_table.to_string(), "customers");
6708-
assert_eq!(constraint.match_kind, Some(MatchKind::Simple));
6708+
assert_eq!(constraint.match_kind, Some(ConstraintReferenceMatchKind::Simple));
67096709
}
67106710
_ => panic!("Expected TableConstraint::ForeignKey"),
67116711
}
@@ -6728,15 +6728,15 @@ fn parse_foreign_key_match_partial() {
67286728
match &columns[0].options[1].option {
67296729
ColumnOption::ForeignKey(constraint) => {
67306730
assert_eq!(constraint.foreign_table.to_string(), "another_table");
6731-
assert_eq!(constraint.match_kind, Some(MatchKind::Partial));
6731+
assert_eq!(constraint.match_kind, Some(ConstraintReferenceMatchKind::Partial));
67326732
}
67336733
_ => panic!("Expected ColumnOption::ForeignKey"),
67346734
}
67356735

67366736
match &constraints[0] {
67376737
TableConstraint::ForeignKey(constraint) => {
67386738
assert_eq!(constraint.foreign_table.to_string(), "customers");
6739-
assert_eq!(constraint.match_kind, Some(MatchKind::Partial));
6739+
assert_eq!(constraint.match_kind, Some(ConstraintReferenceMatchKind::Partial));
67406740
}
67416741
_ => panic!("Expected TableConstraint::ForeignKey"),
67426742
}

0 commit comments

Comments
 (0)