| 1 |
use sqlx_mysqlrust-analyzer cargo sqlx-mysql 0.8.3 crate/::MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#; |
| •2 |
//use sqlx_test::new; |
| 3 |
|
| 4 |
#[sqlxrust-analyzer cargo sqlx 0.8.3 crate/::testrust-analyzer cargo sqlx-macros 0.8.3 test:] |
| •5 |
#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))] |
| 6 |
async fn test_derive_strong_enumrust-analyzer cargo sqlx 0.8.3 test_derive_strong_enum().() -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 7 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 8 |
#[sqlx(rename_all = "PascalCase")] |
| 9 |
enum PascalCaseEnumrust-analyzer cargo sqlx 0.8.3 PascalCaseEnum# { |
| 10 |
FooFoorust-analyzer cargo sqlx 0.8.3 PascalCaseEnum#FooFoo#, |
| 11 |
BarBarrust-analyzer cargo sqlx 0.8.3 PascalCaseEnum#BarBar#, |
| 12 |
BazBazrust-analyzer cargo sqlx 0.8.3 PascalCaseEnum#BazBaz#, |
| 13 |
} |
| 14 |
|
| 15 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 16 |
#[sqlx(rename_all = "camelCase")] |
| 17 |
enum CamelCaseEnumrust-analyzer cargo sqlx 0.8.3 CamelCaseEnum# { |
| 18 |
FooFoorust-analyzer cargo sqlx 0.8.3 CamelCaseEnum#FooFoo#, |
| 19 |
BarBarrust-analyzer cargo sqlx 0.8.3 CamelCaseEnum#BarBar#, |
| 20 |
BazBazrust-analyzer cargo sqlx 0.8.3 CamelCaseEnum#BazBaz#, |
| 21 |
} |
| 22 |
|
| 23 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 24 |
#[sqlx(rename_all = "snake_case")] |
| 25 |
enum SnakeCaseEnumrust-analyzer cargo sqlx 0.8.3 SnakeCaseEnum# { |
| 26 |
FooFoorust-analyzer cargo sqlx 0.8.3 SnakeCaseEnum#FooFoo#, |
| 27 |
BarBarrust-analyzer cargo sqlx 0.8.3 SnakeCaseEnum#BarBar#, |
| 28 |
BazBazrust-analyzer cargo sqlx 0.8.3 SnakeCaseEnum#BazBaz#, |
| 29 |
} |
| 30 |
|
| 31 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 32 |
#[sqlx(rename_all = "SCREAMING_SNAKE_CASE")] |
| 33 |
enum ScreamingSnakeCaseEnumrust-analyzer cargo sqlx 0.8.3 ScreamingSnakeCaseEnum# { |
| 34 |
FooFoorust-analyzer cargo sqlx 0.8.3 ScreamingSnakeCaseEnum#FooFoo#, |
| 35 |
BarBarrust-analyzer cargo sqlx 0.8.3 ScreamingSnakeCaseEnum#BarBar#, |
| 36 |
BazBazrust-analyzer cargo sqlx 0.8.3 ScreamingSnakeCaseEnum#BazBaz#, |
| 37 |
} |
| 38 |
|
| 39 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 40 |
#[sqlx(rename_all = "kebab-case")] |
| 41 |
enum KebabCaseEnumrust-analyzer cargo sqlx 0.8.3 KebabCaseEnum# { |
| 42 |
FooFoorust-analyzer cargo sqlx 0.8.3 KebabCaseEnum#FooFoo#, |
| 43 |
BarBarrust-analyzer cargo sqlx 0.8.3 KebabCaseEnum#BarBar#, |
| 44 |
BazBazrust-analyzer cargo sqlx 0.8.3 KebabCaseEnum#BazBaz#, |
| 45 |
} |
| 46 |
|
| 47 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 48 |
#[sqlx(rename_all = "lowercase")] |
| 49 |
enum LowerCaseEnumrust-analyzer cargo sqlx 0.8.3 LowerCaseEnum# { |
| 50 |
FooFoorust-analyzer cargo sqlx 0.8.3 LowerCaseEnum#FooFoo#, |
| 51 |
BarBarrust-analyzer cargo sqlx 0.8.3 LowerCaseEnum#BarBar#, |
| 52 |
BazBazrust-analyzer cargo sqlx 0.8.3 LowerCaseEnum#BazBaz#, |
| 53 |
} |
| 54 |
|
| 55 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 56 |
#[sqlx(rename_all = "UPPERCASE")] |
| 57 |
enum UpperCaseEnumrust-analyzer cargo sqlx 0.8.3 UpperCaseEnum# { |
| 58 |
FooFoorust-analyzer cargo sqlx 0.8.3 UpperCaseEnum#FooFoo#, |
| 59 |
BarBarrust-analyzer cargo sqlx 0.8.3 UpperCaseEnum#BarBar#, |
| 60 |
BazBazrust-analyzer cargo sqlx 0.8.3 UpperCaseEnum#BazBaz#, |
| 61 |
} |
| 62 |
|
| 63 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 64 |
enum DefaultCaseEnumrust-analyzer cargo sqlx 0.8.3 DefaultCaseEnum# { |
| 65 |
FooFoorust-analyzer cargo sqlx 0.8.3 DefaultCaseEnum#FooFoo#, |
| 66 |
BarBarrust-analyzer cargo sqlx 0.8.3 DefaultCaseEnum#BarBar#, |
| 67 |
BazBazrust-analyzer cargo sqlx 0.8.3 DefaultCaseEnum#BazBaz#, |
| 68 |
} |
| 69 |
|
| 70 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::FromRowrust-analyzer cargo sqlx-macros 0.8.3 FromRow:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 71 |
struct StrongEnumRowrust-analyzer cargo sqlx 0.8.3 StrongEnumRow# { |
| 72 |
pascal_caserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#pascal_case.: PascalCaseEnumrust-analyzer cargo sqlx 0.8.3 PascalCaseEnum#, |
| 73 |
camel_caserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#camel_case.: CamelCaseEnumrust-analyzer cargo sqlx 0.8.3 CamelCaseEnum#, |
| 74 |
snake_caserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#snake_case.: SnakeCaseEnumrust-analyzer cargo sqlx 0.8.3 SnakeCaseEnum#, |
| 75 |
screaming_snake_caserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#screaming_snake_case.: ScreamingSnakeCaseEnumrust-analyzer cargo sqlx 0.8.3 ScreamingSnakeCaseEnum#, |
| 76 |
kebab_caserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#kebab_case.: KebabCaseEnumrust-analyzer cargo sqlx 0.8.3 KebabCaseEnum#, |
| 77 |
lowercaserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#lowercase.: LowerCaseEnumrust-analyzer cargo sqlx 0.8.3 LowerCaseEnum#, |
| 78 |
uppercaserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#uppercase.: UpperCaseEnumrust-analyzer cargo sqlx 0.8.3 UpperCaseEnum#, |
| 79 |
default_caserust-analyzer cargo sqlx 0.8.3 StrongEnumRow#default_case.: DefaultCaseEnumrust-analyzer cargo sqlx 0.8.3 DefaultCaseEnum#, |
| 80 |
} |
| 81 |
|
| •82 |
/*let mut conn = new::<MySql>().await?; |
| 83 |
|
| 84 |
sqlx::raw_sql( |
| 85 |
r#" |
| 86 |
CREATE TEMPORARY TABLE strong_enum ( |
| 87 |
pascal_case ENUM('FooFoo', 'BarBar', 'BazBaz'), |
| 88 |
camel_case ENUM('fooFoo', 'barBar', 'bazBaz'), |
| 89 |
snake_case ENUM('foo_foo', 'bar_bar', 'baz_baz'), |
| 90 |
screaming_snake_case ENUM('FOO_FOO', 'BAR_BAR', 'BAZ_BAZ'), |
| 91 |
kebab_case ENUM('foo-foo', 'bar-bar', 'baz-baz'), |
| 92 |
lowercase ENUM('foofoo', 'barbar', 'bazbaz'), |
| 93 |
uppercase ENUM('FOOFOO', 'BARBAR', 'BAZBAZ'), |
| 94 |
default_case ENUM('FooFoo', 'BarBar', 'BazBaz') |
| 95 |
); |
| 96 |
"#, |
| 97 |
) |
| 98 |
.execute(&mut conn) |
| 99 |
.await?; |
| 100 |
|
| 101 |
let input = StrongEnumRow { |
| 102 |
pascal_case: PascalCaseEnum::FooFoo, |
| 103 |
camel_case: CamelCaseEnum::BarBar, |
| 104 |
snake_case: SnakeCaseEnum::BazBaz, |
| 105 |
screaming_snake_case: ScreamingSnakeCaseEnum::FooFoo, |
| 106 |
kebab_case: KebabCaseEnum::BarBar, |
| 107 |
lowercase: LowerCaseEnum::BazBaz, |
| 108 |
uppercase: UpperCaseEnum::FooFoo, |
| 109 |
default_case: DefaultCaseEnum::BarBar, |
| 110 |
}; |
| 111 |
|
| 112 |
sqlx::query( |
| 113 |
r#" |
| 114 |
INSERT INTO strong_enum( |
| 115 |
pascal_case, |
| 116 |
camel_case, |
| 117 |
snake_case, |
| 118 |
screaming_snake_case, |
| 119 |
kebab_case, |
| 120 |
lowercase, |
| 121 |
uppercase, |
| 122 |
default_case |
| 123 |
) |
| 124 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?) |
| 125 |
"#, |
| 126 |
) |
| 127 |
.bind(&input.pascal_case) |
| 128 |
.bind(&input.camel_case) |
| 129 |
.bind(&input.snake_case) |
| 130 |
.bind(&input.screaming_snake_case) |
| 131 |
.bind(&input.kebab_case) |
| 132 |
.bind(&input.lowercase) |
| 133 |
.bind(&input.uppercase) |
| 134 |
.bind(&input.default_case) |
| 135 |
.execute(&mut conn) |
| 136 |
.await?; |
| 137 |
|
| 138 |
let output: StrongEnumRow = sqlx::query_as("SELECT * FROM strong_enum") |
| 139 |
.fetch_one(&mut conn) |
| 140 |
.await?; |
| 141 |
|
| •142 |
assert_eq!(input, output);*/ |
| 143 |
|
| 144 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 145 |
} |
| 146 |
|
| 147 |
#[sqlxrust-analyzer cargo sqlx 0.8.3 crate/::testrust-analyzer cargo sqlx-macros 0.8.3 test:] |
| •148 |
#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))] |
| 149 |
async fn test_derive_weak_enumrust-analyzer cargo sqlx 0.8.3 test_derive_weak_enum().() -> anyhowrust-analyzer cargo anyhow 1.0.104 crate/::Resultrust-analyzer cargo anyhow 1.0.104 Result#<()> { |
| 150 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 151 |
#[repr(i8)] |
| 152 |
enum WeakEnumI8rust-analyzer cargo sqlx 0.8.3 WeakEnumI8# { |
| 153 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumI8#Foo# = i8::MIN, |
| 154 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumI8#Bar# = 0, |
| 155 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumI8#Baz# = i8::MAX, |
| 156 |
} |
| 157 |
|
| 158 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 159 |
#[repr(i16)] |
| 160 |
enum WeakEnumI16rust-analyzer cargo sqlx 0.8.3 WeakEnumI16# { |
| 161 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumI16#Foo# = i16::MIN, |
| 162 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumI16#Bar# = 0, |
| 163 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumI16#Baz# = i16::MAX, |
| 164 |
} |
| 165 |
|
| 166 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 167 |
#[repr(i32)] |
| 168 |
enum WeakEnumI32rust-analyzer cargo sqlx 0.8.3 WeakEnumI32# { |
| 169 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumI32#Foo# = i32::MIN, |
| 170 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumI32#Bar# = 0, |
| 171 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumI32#Baz# = i32::MAX, |
| 172 |
} |
| 173 |
|
| 174 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 175 |
#[repr(i64)] |
| 176 |
enum WeakEnumI64rust-analyzer cargo sqlx 0.8.3 WeakEnumI64# { |
| 177 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumI64#Foo# = i64::MIN, |
| 178 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumI64#Bar# = 0, |
| 179 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumI64#Baz# = i64::MAX, |
| 180 |
} |
| 181 |
|
| 182 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 183 |
#[repr(u8)] |
| 184 |
enum WeakEnumU8rust-analyzer cargo sqlx 0.8.3 WeakEnumU8# { |
| 185 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumU8#Foo# = 0, |
| 186 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumU8#Bar# = 1, |
| 187 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumU8#Baz# = u8::MAX, |
| 188 |
} |
| 189 |
|
| 190 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| •191 |
#[sqlx(no_pg_array)] |
| 192 |
#[repr(u16)] |
| 193 |
enum WeakEnumU16rust-analyzer cargo sqlx 0.8.3 WeakEnumU16# { |
| 194 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumU16#Foo# = 0, |
| 195 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumU16#Bar# = 1, |
| 196 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumU16#Baz# = u16::MAX, |
| 197 |
} |
| 198 |
|
| 199 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| •200 |
#[sqlx(no_pg_array)] |
| 201 |
#[repr(u32)] |
| 202 |
enum WeakEnumU32rust-analyzer cargo sqlx 0.8.3 WeakEnumU32# { |
| 203 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumU32#Foo# = 0, |
| 204 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumU32#Bar# = 1, |
| 205 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumU32#Baz# = u32::MAX, |
| 206 |
} |
| 207 |
|
| 208 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::Typerust-analyzer cargo sqlx-macros 0.8.3 Type:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| •209 |
#[sqlx(no_pg_array)] |
| 210 |
#[repr(u64)] |
| 211 |
enum WeakEnumU64rust-analyzer cargo sqlx 0.8.3 WeakEnumU64# { |
| 212 |
Foorust-analyzer cargo sqlx 0.8.3 WeakEnumU64#Foo# = 0, |
| 213 |
Barrust-analyzer cargo sqlx 0.8.3 WeakEnumU64#Bar# = 1, |
| 214 |
Bazrust-analyzer cargo sqlx 0.8.3 WeakEnumU64#Baz# = u64::MAX, |
| 215 |
} |
| 216 |
|
| 217 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(sqlxrust-analyzer cargo sqlx 0.8.3 crate/::FromRowrust-analyzer cargo sqlx-macros 0.8.3 FromRow:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)] |
| 218 |
struct WeakEnumRowrust-analyzer cargo sqlx 0.8.3 WeakEnumRow# { |
| 219 |
i8rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#i8.: WeakEnumI8rust-analyzer cargo sqlx 0.8.3 WeakEnumI8#, |
| 220 |
i16rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#i16.: WeakEnumI16rust-analyzer cargo sqlx 0.8.3 WeakEnumI16#, |
| 221 |
i32rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#i32.: WeakEnumI32rust-analyzer cargo sqlx 0.8.3 WeakEnumI32#, |
| 222 |
i64rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#i64.: WeakEnumI64rust-analyzer cargo sqlx 0.8.3 WeakEnumI64#, |
| 223 |
u8rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#u8.: WeakEnumU8rust-analyzer cargo sqlx 0.8.3 WeakEnumU8#, |
| 224 |
u16rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#u16.: WeakEnumU16rust-analyzer cargo sqlx 0.8.3 WeakEnumU16#, |
| 225 |
u32rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#u32.: WeakEnumU32rust-analyzer cargo sqlx 0.8.3 WeakEnumU32#, |
| 226 |
u64rust-analyzer cargo sqlx 0.8.3 WeakEnumRow#u64.: WeakEnumU64rust-analyzer cargo sqlx 0.8.3 WeakEnumU64#, |
| 227 |
} |
| 228 |
|
| •229 |
/*let mut conn = new::<MySql>().await?; |
| 230 |
|
| 231 |
sqlx::raw_sql( |
| 232 |
r#" |
| 233 |
CREATE TEMPORARY TABLE weak_enum ( |
| 234 |
i8 TINYINT, |
| 235 |
i16 SMALLINT, |
| 236 |
i32 INT, |
| 237 |
i64 BIGINT, |
| 238 |
u8 TINYINT UNSIGNED, |
| 239 |
u16 SMALLINT UNSIGNED, |
| 240 |
u32 INT UNSIGNED, |
| 241 |
u64 BIGINT UNSIGNED |
| 242 |
) |
| 243 |
"#, |
| 244 |
) |
| 245 |
.execute(&mut conn) |
| 246 |
.await?; |
| 247 |
|
| 248 |
let rows_in = vec![ |
| 249 |
WeakEnumRow { |
| 250 |
i8: WeakEnumI8::Foo, |
| 251 |
i16: WeakEnumI16::Foo, |
| 252 |
i32: WeakEnumI32::Foo, |
| 253 |
i64: WeakEnumI64::Foo, |
| 254 |
u8: WeakEnumU8::Foo, |
| 255 |
u16: WeakEnumU16::Foo, |
| 256 |
u32: WeakEnumU32::Foo, |
| 257 |
u64: WeakEnumU64::Foo, |
| 258 |
}, |
| 259 |
WeakEnumRow { |
| 260 |
i8: WeakEnumI8::Bar, |
| 261 |
i16: WeakEnumI16::Bar, |
| 262 |
i32: WeakEnumI32::Bar, |
| 263 |
i64: WeakEnumI64::Bar, |
| 264 |
u8: WeakEnumU8::Bar, |
| 265 |
u16: WeakEnumU16::Bar, |
| 266 |
u32: WeakEnumU32::Bar, |
| 267 |
u64: WeakEnumU64::Bar, |
| 268 |
}, |
| 269 |
WeakEnumRow { |
| 270 |
i8: WeakEnumI8::Baz, |
| 271 |
i16: WeakEnumI16::Baz, |
| 272 |
i32: WeakEnumI32::Baz, |
| 273 |
i64: WeakEnumI64::Baz, |
| 274 |
u8: WeakEnumU8::Baz, |
| 275 |
u16: WeakEnumU16::Baz, |
| 276 |
u32: WeakEnumU32::Baz, |
| 277 |
u64: WeakEnumU64::Baz, |
| 278 |
}, |
| 279 |
]; |
| 280 |
|
| 281 |
for row in &rows_in { |
| 282 |
sqlx::query( |
| 283 |
r#" |
| 284 |
INSERT INTO weak_enum(i8, i16, i32, i64, u8, u16, u32, u64) |
| 285 |
VALUES (?, ?, ?, ?, ?, ?, ?, ?) |
| 286 |
"#, |
| 287 |
) |
| 288 |
.bind(&row.i8) |
| 289 |
.bind(&row.i16) |
| 290 |
.bind(&row.i32) |
| 291 |
.bind(&row.i64) |
| 292 |
.bind(&row.u8) |
| 293 |
.bind(&row.u16) |
| 294 |
.bind(&row.u32) |
| 295 |
.bind(&row.u64) |
| 296 |
.execute(&mut conn) |
| 297 |
.await?; |
| 298 |
} |
| 299 |
|
| 300 |
let rows_out: Vec<WeakEnumRow> = sqlx::query_as("SELECT * FROM weak_enum") |
| 301 |
.fetch_all(&mut conn) |
| 302 |
.await?; |
| 303 |
|
| •304 |
assert_eq!(rows_in, rows_out);*/ |
| 305 |
|
| 306 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 307 |
} |