Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/backend/foreign_key_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::*;

#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Mode {
Creation,
Alter,
Expand Down
1 change: 1 addition & 0 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct Expr {
/// [`SimpleExpr`] is a node in the expression tree and can represent identifiers, function calls,
/// various operators and sub-queries.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum SimpleExpr {
Column(ColumnRef),
Tuple(Vec<SimpleExpr>),
Expand Down
1 change: 1 addition & 0 deletions src/extension/mysql/column.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::Iden;

#[derive(Debug, Copy, Clone)]
#[non_exhaustive]
pub enum MySqlType {
TinyBlob,
MediumBlob,
Expand Down
2 changes: 2 additions & 0 deletions src/extension/mysql/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ pub struct IndexHint {
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum IndexHintType {
Use,
Ignore,
Force,
}

#[derive(Debug, Clone, Copy, PartialEq)]
#[non_exhaustive]
pub enum IndexHintScope {
Join,
OrderBy,
Expand Down
1 change: 1 addition & 0 deletions src/extension/postgres/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{expr::*, func::*, PgDateTruncUnit};
///
/// If something is not supported, you can use [`Function::Custom`].
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum PgFunction {
ToTsquery,
ToTsvector,
Expand Down
1 change: 1 addition & 0 deletions src/extension/postgres/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub(crate) mod types;
///
/// For all supported operators (including the standard ones), see [`BinOper`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum PgBinOper {
ILike,
NotILike,
Expand Down
1 change: 1 addition & 0 deletions src/extension/postgres/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub struct TableSample {
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum SampleMethod {
BERNOULLI,
SYSTEM,
Expand Down
5 changes: 5 additions & 0 deletions src/extension/postgres/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{prepare::*, types::*, QueryBuilder, QuotedBuilder};
pub struct Type;

#[derive(Clone, Debug)]
#[non_exhaustive]
pub enum TypeRef {
Type(DynIden),
SchemaType(DynIden, DynIden),
Expand Down Expand Up @@ -59,6 +60,7 @@ pub struct TypeCreateStatement {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TypeAs {
// Composite,
Enum,
Expand All @@ -81,12 +83,14 @@ pub struct TypeAlterStatement {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TypeDropOpt {
Cascade,
Restrict,
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TypeAlterOpt {
Add {
value: DynIden,
Expand All @@ -98,6 +102,7 @@ pub enum TypeAlterOpt {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TypeAlterAddOpt {
Before(DynIden),
After(DynIden),
Expand Down
1 change: 1 addition & 0 deletions src/extension/sqlite/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod expr;
///
/// For all supported operators (including the standard ones), see [`BinOper`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum SqliteBinOper {
/// `GLOB`
Glob,
Expand Down
1 change: 1 addition & 0 deletions src/foreign_key/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct TableForeignKey {

/// Foreign key on update & on delete actions
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub enum ForeignKeyAction {
Restrict,
Cascade,
Expand Down
1 change: 1 addition & 0 deletions src/foreign_key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct ForeignKey;

/// All available types of foreign key statement
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum ForeignKeyStatement {
Create(ForeignKeyCreateStatement),
Drop(ForeignKeyDropStatement),
Expand Down
1 change: 1 addition & 0 deletions src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub use crate::extension::postgres::{PgFunc, PgFunction};
///
/// If something is not supported here, you can use [`Function::Custom`].
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum Function {
Max,
Min,
Expand Down
2 changes: 2 additions & 0 deletions src/index/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct TableIndex {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum IndexColumn {
TableColumn(IndexColumnTableColumn),
Expr(IndexColumnExpr),
Expand Down Expand Up @@ -37,6 +38,7 @@ impl IndexColumn {
}

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum IndexOrder {
Asc,
Desc,
Expand Down
1 change: 1 addition & 0 deletions src/index/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ pub struct IndexCreateStatement {

/// Specification of a table index
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum IndexType {
BTree,
FullText,
Expand Down
1 change: 1 addition & 0 deletions src/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct Index;

/// All available types of index statement
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum IndexStatement {
Create(IndexCreateStatement),
Drop(IndexDropStatement),
Expand Down
5 changes: 5 additions & 0 deletions src/query/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub struct SelectStatement {

/// List of distinct keywords that can be used in select statement
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum SelectDistinct {
All,
Distinct,
Expand All @@ -72,6 +73,7 @@ pub enum SelectDistinct {

/// Window type in [`SelectExpr`]
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum WindowSelectType {
/// Name in [`SelectStatement`]
Name(DynIden),
Expand All @@ -98,6 +100,7 @@ pub struct JoinExpr {

/// List of lock types that can be used in select statement
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum LockType {
/// Exclusive lock
Update,
Expand All @@ -109,6 +112,7 @@ pub enum LockType {

/// List of lock behavior can be used in select statement
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum LockBehavior {
Nowait,
SkipLocked,
Expand All @@ -123,6 +127,7 @@ pub struct LockClause {

/// List of union types that can be used in union clause
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum UnionType {
Intersect,
Distinct,
Expand Down
1 change: 1 addition & 0 deletions src/query/with.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ impl CommonTableExpression {
/// For recursive [WithQuery] [WithClause]s the traversing order can be specified in some databases
/// that support this functionality.
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum SearchOrder {
/// Breadth first traversal during the execution of the recursive query.
BREADTH,
Expand Down
1 change: 1 addition & 0 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::{backend::SchemaBuilder, ForeignKeyStatement, IndexStatement, TableStatement};

#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum SchemaStatement {
TableStatement(TableStatement),
IndexStatement(IndexStatement),
Expand Down
1 change: 1 addition & 0 deletions src/table/alter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub struct AddColumnOption {

/// All available table alter options
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TableAlterOption {
AddColumn(AddColumnOption),
ModifyColumn(ColumnDef),
Expand Down
3 changes: 3 additions & 0 deletions src/table/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl ColumnType {

/// All column specification keywords
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum ColumnSpec {
Null,
NotNull,
Expand All @@ -187,6 +188,7 @@ pub enum ColumnSpec {

// All interval fields
#[derive(Debug, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PgInterval {
Year,
Month,
Expand All @@ -205,6 +207,7 @@ pub enum PgInterval {

// All possible inputs to DATE_TRUNC (https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC)
#[derive(Debug, Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum PgDateTruncUnit {
Microseconds,
Milliseconds,
Expand Down
2 changes: 2 additions & 0 deletions src/table/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub struct TableCreateStatement {

/// All available table options
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TableOpt {
Engine(String),
Collate(String),
Expand All @@ -104,6 +105,7 @@ pub enum TableOpt {

/// All available table partition options
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TablePartition {}

impl TableCreateStatement {
Expand Down
1 change: 1 addition & 0 deletions src/table/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct TableDropStatement {

/// All available table drop options
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TableDropOpt {
Restrict,
Cascade,
Expand Down
1 change: 1 addition & 0 deletions src/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub struct Table;

/// All available types of table statement
#[derive(Debug, Clone)]
#[non_exhaustive]
pub enum TableStatement {
Create(TableCreateStatement),
Alter(TableAlterStatement),
Expand Down
1 change: 1 addition & 0 deletions src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct Tokenizer {
}

#[derive(Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum Token {
Quoted(String),
Unquoted(String),
Expand Down
8 changes: 8 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ impl fmt::Debug for dyn Iden {

/// Column references
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum ColumnRef {
Column(DynIden),
TableColumn(DynIden, DynIden),
Expand All @@ -146,6 +147,7 @@ pub trait IntoColumnRef {
/// Table references
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum TableRef {
/// Table identifier without any schema / database prefix
Table(DynIden),
Expand Down Expand Up @@ -173,6 +175,7 @@ pub trait IntoTableRef {

/// Unary operators.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum UnOper {
Not,
}
Expand All @@ -181,6 +184,7 @@ pub enum UnOper {
///
/// If something is not supported here, you can use [`BinOper::Custom`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum BinOper {
And,
Or,
Expand Down Expand Up @@ -251,13 +255,15 @@ pub struct OrderExpr {

/// Join on types
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum JoinOn {
Condition(Box<ConditionHolder>),
Columns(Vec<SimpleExpr>),
}

/// Ordering options
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum Order {
Asc,
Desc,
Expand Down Expand Up @@ -334,6 +340,7 @@ pub struct Asterisk;
///
/// If something is not supported here, you can use [`Keyword::Custom`].
#[derive(Debug, Clone, PartialEq)]
#[non_exhaustive]
pub enum Keyword {
Null,
CurrentDate,
Expand All @@ -355,6 +362,7 @@ pub trait IntoLikeExpr {

/// SubQuery operators
#[derive(Debug, Copy, Clone, PartialEq)]
#[non_exhaustive]
pub enum SubQueryOper {
Exists,
Any,
Expand Down
3 changes: 3 additions & 0 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use crate::{ColumnType, CommonSqlQueryBuilder, QueryBuilder, StringLen};

/// [`Value`] types variant for Postgres array
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
#[non_exhaustive]
pub enum ArrayType {
Bool,
TinyInt,
Expand Down Expand Up @@ -124,6 +125,7 @@ pub enum ArrayType {
/// implementation of NaN != NaN.
#[derive(Clone, Debug)]
#[cfg_attr(not(feature = "hashable-value"), derive(PartialEq))]
#[non_exhaustive]
pub enum Value {
Bool(Option<bool>),
TinyInt(Option<i8>),
Expand Down Expand Up @@ -259,6 +261,7 @@ pub struct Values(pub Vec<Value>);

#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "hashable-value", derive(Hash, Eq))]
#[non_exhaustive]
pub enum ValueTuple {
One(Value),
Two(Value, Value),
Expand Down
Loading