Skip to content

Commit 42ce24d

Browse files
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
1 parent 35c78f5 commit 42ce24d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sqlx-postgres/src/types/lquery.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::decode::Decode;
22
use crate::encode::{Encode, IsNull};
33
use crate::error::BoxDynError;
44
use crate::types::Type;
5-
use crate::{PgArgumentBuffer, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
5+
use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
66
use bitflags::bitflags;
77
use std::fmt::{self, Display, Formatter};
88
use std::io::Write;
@@ -161,6 +161,12 @@ impl Type<Postgres> for PgLQuery {
161161
}
162162
}
163163

164+
impl PgHasArrayType for PgLQuery {
165+
fn array_type_info() -> PgTypeInfo {
166+
PgTypeInfo::with_name("_lquery")
167+
}
168+
}
169+
164170
impl Encode<'_, Postgres> for PgLQuery {
165171
fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> Result<IsNull, BoxDynError> {
166172
buf.extend(1i8.to_le_bytes());

0 commit comments

Comments
 (0)