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

Clarify relationship between general SQL types and backend-specific types #225

Closed
jimmycuadra opened this Issue Feb 24, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@jimmycuadra
Contributor

jimmycuadra commented Feb 24, 2016

The backend-specific types, e.g. diesel::data_types, contain some types that have seemingly identical counterparts in diesel::types. For example, there is both diesel::types::Timestamp and diesel::data_types::PgTimestamp. It's not clear why you would use one over the other. The docs for the backend-specific types say they are for cases where there is no native Rust type, and yet matching types appear in the generic types module anyway. Are both of them user-facing types? Is one an implementation detail that happens to be public? If you're using Postgres and the table! macro, which one do you use to declare a timestamp column? The docs should explain this. The module names types and data_types also have no semantic distinction which adds to the confusion.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 25, 2016

You would always use types::Timestamp in the table macro. data_types::PgTimestamp is something that can be deserialized from a column of that type.

@sgrif sgrif closed this Feb 25, 2016

@jimmycuadra

This comment has been minimized.

Contributor

jimmycuadra commented Feb 25, 2016

Thanks! I can make a PR to add some docs explaining this. Is there anything else actionable here? Maybe a way to name the types and data_types module that's more clear?

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