1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use std::fmt;
/// A SQL set operation that combines result sets from multiple queries.
///
/// Used by [`ExprSetOp`](super::ExprSetOp) to specify how multiple query
/// results are combined.
///
/// # Examples
///
/// ```
/// use toasty_core::stmt::SetOp;
///
/// let op = SetOp::Union;
/// assert_eq!(op.to_string(), "UNION");
/// ```
#[derive(Copy, Clone, PartialEq)]
pub enum SetOp {
/// Combines results from multiple queries, including duplicates.
Union,
/// Returns rows from the first query that are not in the second.
Except,
/// Returns only rows common to both queries.
Intersect,
}
impl SetOp {}
impl fmt::Display for SetOp {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
SetOp::Union => "UNION".fmt(f),
SetOp::Except => "EXCEPT".fmt(f),
SetOp::Intersect => "INTERSECT".fmt(f),
}
}
}
impl fmt::Debug for SetOp {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}