mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 16:44:07 +00:00
Added missing special casing for encoding embedded arrays of custom types (#3603)
* Added missing special casing for encoding arrays of custom types * Added the matching test * Formatting
This commit is contained in:
@@ -41,13 +41,13 @@ impl<'a> PgRecordEncoder<'a> {
|
||||
{
|
||||
let ty = value.produces().unwrap_or_else(T::type_info);
|
||||
|
||||
if let PgType::DeclareWithName(name) = ty.0 {
|
||||
match ty.0 {
|
||||
// push a hole for this type ID
|
||||
// to be filled in on query execution
|
||||
self.buf.patch_type_by_name(&name);
|
||||
} else {
|
||||
PgType::DeclareWithName(name) => self.buf.patch_type_by_name(&name),
|
||||
PgType::DeclareArrayOf(array) => self.buf.patch_array_type(array),
|
||||
// write type id
|
||||
self.buf.extend(&ty.0.oid().0.to_be_bytes());
|
||||
pg_type => self.buf.extend(&pg_type.oid().0.to_be_bytes()),
|
||||
}
|
||||
|
||||
self.buf.encode(value)?;
|
||||
|
||||
Reference in New Issue
Block a user