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 up[feature request] support domains #595
Comments
This comment has been minimized.
|
A first step in pseudecode would be (in infer_schema)
This would mean they were useable in diesel, just that no extra type information is inferred. |
This comment has been minimized.
|
Certainly for the cases covered by that pseudocode this seems completely reasonable to add |
This comment has been minimized.
|
I've thought about this some more and I'm not sure if what I suggested is better than implementing a custom data type (I think I saw |
killercup
added
enhancement
postgres
labels
Feb 17, 2017
This comment has been minimized.
|
So I don't think I want to add support for "treat domain type as its base type". That check constraint you've provided means that the range of values that can be serialized differ from those of the base type. In this case you can create Types that aren't in table! {
use diesel::types::*;
use my_types::*;
foo {
id -> Integer,
bar -> MyType,
}
} |
derekdreery commentedJan 29, 2017
•
edited
Here is an explanation of domains. They are used for custom data types and are constructed from existing data types with optional constraints.
e.g. I want to use the following domain
They provide additional consistency within a database. Currently, using
infer_schemaerrors onunresolved type 'diesel::types::Gender'in the above example.