mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-10 12:16:30 +00:00
feat: implement Encode, Decode, Type for Arc<str> and Arc<[u8]> (and Rc equivalents) (#3675)
* implement Encode, Decode, Type for Arc<str> and Arc<[u8]> (and Rc equivalents) * sqlx-sqlite: Remove clone in Encode impl * sqlx-sqlite: Remove unnecessary impls
This commit is contained in:
@@ -310,9 +310,13 @@ test_type!(test_rc<Rc<i32>>(MySql, "1" == Rc::new(1i32)));
|
||||
|
||||
test_type!(test_box_str<Box<str>>(MySql, "'John'" == Box::<str>::from("John")));
|
||||
test_type!(test_cow_str<Cow<'_, str>>(MySql, "'Phil'" == Cow::<'static, str>::from("Phil")));
|
||||
test_type!(test_arc_str<Arc<str>>(MySql, "'1234'" == Arc::<str>::from("1234")));
|
||||
test_type!(test_rc_str<Rc<str>>(MySql, "'5678'" == Rc::<str>::from("5678")));
|
||||
|
||||
test_prepared_type!(test_box_slice<Box<[u8]>>(MySql, "X'01020304'" == Box::<[u8]>::from([1,2,3,4])));
|
||||
test_prepared_type!(test_cow_slice<Cow<'_, [u8]>>(MySql, "X'01020304'" == Cow::<'static, [u8]>::from(&[1,2,3,4])));
|
||||
test_prepared_type!(test_arc_slice<Arc<[u8]>>(MySql, "X'01020304'" == Arc::<[u8]>::from([1,2,3,4])));
|
||||
test_prepared_type!(test_rc_slice<Rc<[u8]>>(MySql, "X'01020304'" == Rc::<[u8]>::from([1,2,3,4])));
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn test_bits() -> anyhow::Result<()> {
|
||||
|
||||
@@ -704,9 +704,13 @@ test_type!(test_rc<Rc<i32>>(Postgres, "1::INT4" == Rc::new(1i32)));
|
||||
|
||||
test_type!(test_box_str<Box<str>>(Postgres, "'John'::TEXT" == Box::<str>::from("John")));
|
||||
test_type!(test_cow_str<Cow<'_, str>>(Postgres, "'Phil'::TEXT" == Cow::<'static, str>::from("Phil")));
|
||||
test_type!(test_arc_str<Arc<str>>(Postgres, "'1234'::TEXT" == Arc::<str>::from("1234")));
|
||||
test_type!(test_rc_str<Rc<str>>(Postgres, "'5678'::TEXT" == Rc::<str>::from("5678")));
|
||||
|
||||
test_prepared_type!(test_box_slice<Box<[u8]>>(Postgres, "'\\x01020304'::BYTEA" == Box::<[u8]>::from([1,2,3,4])));
|
||||
test_prepared_type!(test_cow_slice<Cow<'_, [u8]>>(Postgres, "'\\x01020304'::BYTEA" == Cow::<'static, [u8]>::from(&[1,2,3,4])));
|
||||
test_prepared_type!(test_arc_slice<Arc<[u8]>>(Postgres, "'\\x01020304'::BYTEA" == Arc::<[u8]>::from([1,2,3,4])));
|
||||
test_prepared_type!(test_rc_slice<Rc<[u8]>>(Postgres, "'\\x01020304'::BYTEA" == Rc::<[u8]>::from([1,2,3,4])));
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn test_text_adapter() -> anyhow::Result<()> {
|
||||
|
||||
@@ -219,9 +219,13 @@ test_type!(test_rc<Rc<i32>>(Sqlite, "1" == Rc::new(1i32)));
|
||||
|
||||
test_type!(test_box_str<Box<str>>(Sqlite, "'John'" == Box::<str>::from("John")));
|
||||
test_type!(test_cow_str<Cow<'_, str>>(Sqlite, "'Phil'" == Cow::<'static, str>::from("Phil")));
|
||||
test_type!(test_arc_str<Arc<str>>(Sqlite, "'1234'" == Arc::<str>::from("1234")));
|
||||
test_type!(test_rc_str<Rc<str>>(Sqlite, "'5678'" == Rc::<str>::from("5678")));
|
||||
|
||||
test_type!(test_box_slice<Box<[u8]>>(Sqlite, "X'01020304'" == Box::<[u8]>::from([1,2,3,4])));
|
||||
test_type!(test_cow_slice<Cow<'_, [u8]>>(Sqlite, "X'01020304'" == Cow::<'static, [u8]>::from(&[1,2,3,4])));
|
||||
test_type!(test_arc_slice<Arc<[u8]>>(Sqlite, "X'01020304'" == Arc::<[u8]>::from([1,2,3,4])));
|
||||
test_type!(test_rc_slice<Rc<[u8]>>(Sqlite, "X'01020304'" == Rc::<[u8]>::from([1,2,3,4])));
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn test_text_adapter() -> anyhow::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user