mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-30 13:20:59 +00:00
* 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
17 lines
375 B
Rust
17 lines
375 B
Rust
pub trait Encode<'en, Context = ()> {
|
|
fn encode(&self, buf: &mut Vec<u8>)
|
|
where
|
|
Self: Encode<'en, ()>,
|
|
{
|
|
self.encode_with(buf, ());
|
|
}
|
|
|
|
fn encode_with(&self, buf: &mut Vec<u8>, context: Context);
|
|
}
|
|
|
|
impl<'en, C> Encode<'en, C> for &'_ [u8] {
|
|
fn encode_with(&self, buf: &mut Vec<u8>, _: C) {
|
|
buf.extend_from_slice(self);
|
|
}
|
|
}
|