feophantlib/engine/objects/
constraints.rs

1use super::Index;
2use std::{
3    fmt::{self, Display, Formatter},
4    sync::Arc,
5};
6
7mod parse_constraint;
8
9#[derive(Clone, Debug, PartialEq)]
10pub enum Constraint {
11    PrimaryKey(PrimaryKeyConstraint),
12}
13
14/// ConstraintMapper exists to map to SqlType without imposing the cost of an empty version
15///
16/// This will exist until this RFC is brought back: https://github.com/rust-lang/rfcs/pull/2593
17#[derive(Clone, Debug, PartialEq)]
18pub enum ConstraintMapper {
19    PrimaryKey,
20}
21
22impl Display for ConstraintMapper {
23    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
24        write!(f, "PrimaryKey")
25    }
26}
27
28#[derive(Clone, Debug, PartialEq)]
29pub struct PrimaryKeyConstraint {
30    pub name: String,
31    pub index: Arc<Index>,
32}