refactor(core): remove the HRTB (higher rank trait bound) on Row in the aim of improving ergonomics

* removes the lifetime from Row

 * removes MySqlQueryAs, SqliteQueryAs, etc. (no longer needed)

 * introduce query_scalar

 * introduce Decode::accepts to allow overriding runtime type checking
   per-type (replaces TypeInfo::compatible)

 * introduce Encode::produces to allow overriding the encoded type per-value

 * adds a lifetime to Arguments (and introduce the HRTB HasArguments)
   to support zero-copy encoding with SQLite

 * renames Database::RawBuffer to HasArguments::ArgumentBuffer

 * introduce Connect::connect_with to provide an ConnectOptions type
   explicitly to opt-out of connection string parsing

 * introduce Value and ValueRef traits to allow decoding-deferred
   extraction of values from Rows

 * introduce Encode::encode_by_ref and change Encode::encode to take
   by-value to try and re-use memory where possible

 * use thiserror to generate sqlx::Error

 * [!] temporarily removes query logging

 * [!] temporarily removes transactions
This commit is contained in:
Ryan Leckey
2020-05-26 01:56:03 -07:00
parent a233fbfdb7
commit 757a930e21
43 changed files with 2549 additions and 2668 deletions

View File

@@ -28,7 +28,7 @@ pub use native_tls;
))]
pub use tokio::{
self, fs, io::AsyncRead, io::AsyncReadExt, io::AsyncWrite, io::AsyncWriteExt, net::TcpStream,
task::yield_now,
task::yield_now, time::delay_for as sleep, time::timeout,
};
#[cfg(all(
@@ -89,8 +89,9 @@ macro_rules! blocking {
not(any(feature = "runtime-actix", feature = "runtime-tokio",))
))]
pub use async_std::{
self, fs, io::prelude::ReadExt as AsyncReadExt, io::prelude::WriteExt as AsyncWriteExt,
io::Read as AsyncRead, io::Write as AsyncWrite, net::TcpStream, task::spawn, task::yield_now,
self, fs, future::timeout, io::prelude::ReadExt as AsyncReadExt,
io::prelude::WriteExt as AsyncWriteExt, io::Read as AsyncRead, io::Write as AsyncWrite,
net::TcpStream, task::sleep, task::spawn, task::yield_now,
};
#[cfg(all(