elefant_tools/models/
check_constraint.rs

1use crate::object_id::ObjectId;
2use crate::whitespace_ignorant_string::WhitespaceIgnorantString;
3use serde::{Deserialize, Serialize};
4use std::cmp::Ordering;
5
6#[derive(Debug, Eq, PartialEq, Default, Clone, Serialize, Deserialize)]
7pub struct PostgresCheckConstraint {
8    pub name: String,
9    pub check_clause: WhitespaceIgnorantString,
10    pub comment: Option<String>,
11    pub object_id: ObjectId,
12}
13
14impl PartialOrd for PostgresCheckConstraint {
15    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
16        Some(self.cmp(other))
17    }
18}
19
20impl Ord for PostgresCheckConstraint {
21    fn cmp(&self, other: &Self) -> Ordering {
22        self.name.cmp(&other.name)
23    }
24}