mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +00:00
Add support for Postgres lquery arrays (#3553)
An lquery array can be used with the `?` operator for "Does ltree match any lquery in array?" Documentation: https://www.postgresql.org/docs/current/ltree.html#LTREE-OPS-FUNCS Closes #2246
This commit is contained in:
parent
35c78f5175
commit
42ce24dab8
@ -2,7 +2,7 @@ use crate::decode::Decode;
|
||||
use crate::encode::{Encode, IsNull};
|
||||
use crate::error::BoxDynError;
|
||||
use crate::types::Type;
|
||||
use crate::{PgArgumentBuffer, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
|
||||
use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
|
||||
use bitflags::bitflags;
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::io::Write;
|
||||
@ -161,6 +161,12 @@ impl Type<Postgres> for PgLQuery {
|
||||
}
|
||||
}
|
||||
|
||||
impl PgHasArrayType for PgLQuery {
|
||||
fn array_type_info() -> PgTypeInfo {
|
||||
PgTypeInfo::with_name("_lquery")
|
||||
}
|
||||
}
|
||||
|
||||
impl Encode<'_, Postgres> for PgLQuery {
|
||||
fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> Result<IsNull, BoxDynError> {
|
||||
buf.extend(1i8.to_le_bytes());
|
||||
|
Loading…
x
Reference in New Issue
Block a user