Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upHow to store phone numbers in Postgres? #1654
Comments
weiznich
added
the
question
label
Apr 22, 2018
This comment has been minimized.
|
In general it is totally possible to implement custom types outside of diesel. The test case you linked is basically the blue print for implementing such an type. It is really hard to answer this question without any code to reproduce this. Please add the your current code and the current (exact) error to the issue. I will close this issue because it does not contain anything that actionable for us to fix in diesel. |
weiznich
closed this
Apr 22, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
spease commentedApr 22, 2018
This could also be generalized to "How to make a custom type work with diesel?"
Basically, I'd like to be able to load and store phone numbers that I'm storing with the phonenumber crate into a postgres database.
It looks like there's a postges extension for this:
https://github.com/blm768/pg-libphonenumber
But I'd just be happy with being able to do it with a text type for now.
I tried implementing FromSql and ToSql for a wrapper type as seen in this example:
https://github.com/diesel-rs/diesel/blob/master/diesel_tests/tests/custom_types.rs#L42
But this approach gets stuck on "only traits in the current crate can be implemented for arbitrary types".
Thanks.