Skip to content

Commit

Permalink
Bump sqlx 0.7 -> 0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dzejkop committed Oct 15, 2024
1 parent 293d296 commit 9a1a601
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ bytes = { version = "1.4", optional = true }
postgres-types = { version = "0.2", optional = true }

# sqlx
sqlx-core = { version = "0.7", optional = true }
sqlx-core = { version = "0.8.2", optional = true }

[dev-dependencies]
ruint = { path = ".", features = ["arbitrary", "proptest"] }
Expand Down
22 changes: 12 additions & 10 deletions src/support/sqlx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
#![cfg(feature = "sqlx")]
#![cfg_attr(docsrs, doc(cfg(feature = "sqlx")))]

use crate::Uint;
use sqlx_core::{
database::{Database, HasArguments, HasValueRef},
decode::Decode,
encode::{Encode, IsNull},
error::BoxDynError,
types::Type,
};
use sqlx_core::database::Database;
use sqlx_core::decode::Decode;
use sqlx_core::encode::{Encode, IsNull};
use sqlx_core::error::BoxDynError;
use sqlx_core::types::Type;
use thiserror::Error;

use crate::Uint;

#[derive(Error, Debug)]
pub enum DecodeError {
#[error("Value too large for target type")]
Expand All @@ -38,7 +37,10 @@ impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Encode<'a, DB> for
where
Vec<u8>: Encode<'a, DB>,
{
fn encode_by_ref(&self, buf: &mut <DB as HasArguments<'a>>::ArgumentBuffer) -> IsNull {
fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'a>,
) -> Result<IsNull, BoxDynError> {
self.to_be_bytes_vec().encode_by_ref(buf)
}
}
Expand All @@ -47,7 +49,7 @@ impl<'a, const BITS: usize, const LIMBS: usize, DB: Database> Decode<'a, DB> for
where
Vec<u8>: Decode<'a, DB>,
{
fn decode(value: <DB as HasValueRef<'a>>::ValueRef) -> Result<Self, BoxDynError> {
fn decode(value: <DB as Database>::ValueRef<'a>) -> Result<Self, BoxDynError> {
let bytes = Vec::<u8>::decode(value)?;
Self::try_from_be_slice(bytes.as_slice()).ok_or_else(|| DecodeError::Overflow.into())
}
Expand Down

0 comments on commit 9a1a601

Please sign in to comment.