Skip to content

Rewrite Postgres array type handling - #1385

Merged
abonander merged 1 commit into
transact-rs:masterfrom
lumeohq:postgres-array
Nov 23, 2021
Merged

abonander merged 1 commit into
transact-rs:masterfrom
lumeohq:postgres-array

Conversation

@jplatte

@jplatte jplatte commented Aug 17, 2021 •

Copy link
Copy Markdown
Contributor

… to reduce boilerplate and allow custom types.

Fixes Relates to #298.

Future possibilities: Let the Type derive macro generate an impl of the new PgHasArrayType trait.

@abonander abonander mentioned this pull request Aug 30, 2021
2 of 8 tasks
Comment thread sqlx-core/src/postgres/array.rs Resolved
… to reduce boilerplate and allow custom types.
@jplatte

jplatte commented Nov 13, 2021

Copy link
Copy Markdown
Contributor Author

I am pretty certain this is not a breaking change. It only introduces a new trait and
re-routes existing Type implementations through that trait (not changing whether those types implement Type). Outside crates were never able to implement Type for [Foo] / Type for &'_ [Foo] / Type for Vec<Foo> before, so the new blanket impl doesn't break that either.

@abonander
abonander merged commit 12d9f54 into transact-rs:master Nov 23, 2021
@jplatte
jplatte deleted the postgres-array branch November 23, 2021 06:42
@meh

meh commented Dec 5, 2021

Copy link
Copy Markdown
Contributor

Is there a way to create a PgTypeInfo::with_name to implement PgHasArrayType?

@jplatte

jplatte commented Dec 5, 2021

Copy link
Copy Markdown
Contributor Author

Yes, the idea is that you would implement PgHasArrayType for custom types as PgTypeInfo::with_name("_custom_type_name") (when the non-array type is called custom_type_name without the leading underscore).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants