sea_query/
tests_cfg.rs

1//! Configurations for test cases and examples. Not intended for actual use.
2
3use std::fmt;
4
5#[cfg(feature = "with-json")]
6pub use serde_json::json;
7
8use crate::Iden;
9
10/// Representation of a database table named `Character`.
11///
12/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
13///
14/// [`Iden`]: crate::types::Iden
15#[derive(Debug)]
16pub enum Character {
17    Table,
18    Id,
19    Character,
20    FontSize,
21    SizeW,
22    SizeH,
23    FontId,
24    Ascii,
25    CreatedAt,
26    UserData,
27}
28
29/// A shorthand for [`Character`]
30pub type Char = Character;
31
32impl Iden for Character {
33    fn unquoted(&self, s: &mut dyn fmt::Write) {
34        write!(
35            s,
36            "{}",
37            match self {
38                Self::Table => "character",
39                Self::Id => "id",
40                Self::Character => "character",
41                Self::FontSize => "font_size",
42                Self::SizeW => "size_w",
43                Self::SizeH => "size_h",
44                Self::FontId => "font_id",
45                Self::Ascii => "ascii",
46                Self::CreatedAt => "created_at",
47                Self::UserData => "user_data",
48            }
49        )
50        .unwrap();
51    }
52}
53
54/// Representation of a database table named `Font`.
55///
56/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
57///
58/// [`Iden`]: crate::types::Iden
59#[derive(Debug)]
60pub enum Font {
61    Table,
62    Id,
63    Name,
64    Variant,
65    Language,
66}
67
68impl Iden for Font {
69    fn unquoted(&self, s: &mut dyn fmt::Write) {
70        write!(
71            s,
72            "{}",
73            match self {
74                Self::Table => "font",
75                Self::Id => "id",
76                Self::Name => "name",
77                Self::Variant => "variant",
78                Self::Language => "language",
79            }
80        )
81        .unwrap();
82    }
83}
84
85/// Representation of a database table named `Glyph`.
86///
87/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
88///
89/// [`Iden`]: crate::types::Iden
90#[derive(Debug)]
91pub enum Glyph {
92    Table,
93    Id,
94    Image,
95    Aspect,
96    Tokens,
97}
98
99impl Iden for Glyph {
100    fn unquoted(&self, s: &mut dyn fmt::Write) {
101        write!(
102            s,
103            "{}",
104            match self {
105                Self::Table => "glyph",
106                Self::Id => "id",
107                Self::Image => "image",
108                Self::Aspect => "aspect",
109                Self::Tokens => "tokens",
110            }
111        )
112        .unwrap();
113    }
114}
115
116/// Representation of a database table named `Task`.
117///
118/// A `Enum` implemented [`Iden`] used in rustdoc and test to demonstrate the library usage.
119///
120/// [`Iden`]: crate::types::Iden
121#[derive(Debug)]
122pub enum Task {
123    Table,
124    Id,
125    IsDone,
126}
127
128impl Iden for Task {
129    fn unquoted(&self, s: &mut dyn fmt::Write) {
130        write!(
131            s,
132            "{}",
133            match self {
134                Self::Table => "task",
135                Self::Id => "id",
136                Self::IsDone => "is_done",
137            }
138        )
139        .unwrap();
140    }
141}