Change sqlx::Any to sqlx::Postgres
This commit is contained in:
parent
ec9541f38e
commit
ccef3128a1
|
@ -49,13 +49,11 @@ log = "0.4.22"
|
||||||
async-trait = "0.1.81"
|
async-trait = "0.1.81"
|
||||||
chorus-macros = { path = "./chorus-macros", version = "0" } # Note: version here is used when releasing. This will use the latest release. Make sure to republish the crate when code in macros is changed!
|
chorus-macros = { path = "./chorus-macros", version = "0" } # Note: version here is used when releasing. This will use the latest release. Make sure to republish the crate when code in macros is changed!
|
||||||
sqlx = { version = "0.8.0", features = [
|
sqlx = { version = "0.8.0", features = [
|
||||||
"mysql",
|
|
||||||
"sqlite",
|
|
||||||
"json",
|
"json",
|
||||||
"chrono",
|
"chrono",
|
||||||
"ipnetwork",
|
"ipnetwork",
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"any",
|
"postgres",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
discortp = { version = "0.5.0", optional = true, features = [
|
discortp = { version = "0.5.0", optional = true, features = [
|
||||||
"rtp",
|
"rtp",
|
||||||
|
|
|
@ -164,23 +164,23 @@ pub fn sqlx_bitflag_derive(input: TokenStream) -> TokenStream {
|
||||||
|
|
||||||
quote!{
|
quote!{
|
||||||
#[cfg(feature = "sqlx")]
|
#[cfg(feature = "sqlx")]
|
||||||
impl sqlx::Type<sqlx::Any> for #name {
|
impl sqlx::Type<sqlx::Postgres> for #name {
|
||||||
fn type_info() -> sqlx::any::AnyTypeInfo {
|
fn type_info() -> sqlx::postgres::PgTypeInfo {
|
||||||
<Vec<u8> as sqlx::Type<sqlx::Any>>::type_info()
|
<Vec<u8> as sqlx::Type<sqlx::Postgres>>::type_info()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "sqlx")]
|
#[cfg(feature = "sqlx")]
|
||||||
impl<'q> sqlx::Encode<'q, sqlx::Any> for #name {
|
impl<'q> sqlx::Encode<'q, sqlx::Postgres> for #name {
|
||||||
fn encode_by_ref(&self, buf: &mut <sqlx::Any as sqlx::Database>::ArgumentBuffer<'q>) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> {
|
fn encode_by_ref(&self, buf: &mut <sqlx::Postgres as sqlx::Database>::ArgumentBuffer<'q>) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> {
|
||||||
<Vec<u8> as sqlx::Encode<sqlx::Any>>::encode_by_ref(&self.bits().to_be_bytes().into(), buf)
|
<Vec<u8> as sqlx::Encode<sqlx::Postgres>>::encode_by_ref(&self.bits().to_be_bytes().into(), buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "sqlx")]
|
#[cfg(feature = "sqlx")]
|
||||||
impl<'q> sqlx::Decode<'q, sqlx::Any> for #name {
|
impl<'q> sqlx::Decode<'q, sqlx::Postgres> for #name {
|
||||||
fn decode(value: <sqlx::Any as sqlx::Database>::ValueRef<'q>) -> Result<Self, sqlx::error::BoxDynError> {
|
fn decode(value: <sqlx::Postgres as sqlx::Database>::ValueRef<'q>) -> Result<Self, sqlx::error::BoxDynError> {
|
||||||
let vec = <Vec<u8> as sqlx::Decode<sqlx::Any>>::decode(value)?;
|
let vec = <Vec<u8> as sqlx::Decode<sqlx::Postgres>>::decode(value)?;
|
||||||
Ok(Self::from_bits(vec_u8_to_u64(vec)).unwrap())
|
Ok(Self::from_bits(vec_u8_to_u64(vec)).unwrap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,7 +342,7 @@ pub struct DefaultReaction {
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
|
||||||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
|
||||||
#[repr(u32)]
|
#[repr(i32)]
|
||||||
/// # Reference
|
/// # Reference
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/channel#channel-type>
|
/// See <https://discord-userdoccers.vercel.app/resources/channel#channel-type>
|
||||||
pub enum ChannelType {
|
pub enum ChannelType {
|
||||||
|
|
Loading…
Reference in New Issue