Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose PgTypeInfo consts for implement Type outside #3512

Closed
wants to merge 1 commit into from

Conversation

tisonkun
Copy link
Contributor

@tisonkun tisonkun commented Sep 20, 2024

Currently, when you want to implement extend types:

use sqlx::{Postgres, Type};
use sqlx::postgres::PgTypeInfo;

pub struct Timestamp(jiff::Timestamp);

impl Type<Postgres> for Timestamp {
    fn type_info() -> PgTypeInfo {
        PgTypeInfo::TIMESTAMPTZ
    }
}

It will fail with Constant `TIMESTAMPTZ` is private [E0603].

These consts can be public for implement Type outside.

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun
Copy link
Contributor Author

Closed -

There is: I don't want the docs page for PgTypeInfo to be a miles-long list of associated consts with its methods and trait impls buried at the very bottom.

Perhaps these could live in a postgres::types::catalog module, but I'd need to think on that. I'd want to do all of them at once, which is out-of-scope for this PR.

from #3511 (comment).

@tisonkun tisonkun closed this Sep 20, 2024
@tisonkun tisonkun deleted the expose-PgTypeInfo branch September 20, 2024 02:40
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.

1 participant