ecto_enum icon indicating copy to clipboard operation
ecto_enum copied to clipboard

Support Composite types in Postgres

Open gjaldon opened this issue 4 years ago • 1 comments

It would be nice to be able to express in Ecto a datatype like:

:unused | {:next, id} | :finished

gjaldon avatar Aug 29 '19 06:08 gjaldon

How it's going to work? If I remember correctly composite types have fixed number of attributes, right?

Did you mean: {:unused, nil} | {:next, id} | {:finished, nil}? If so then I believe that it should not be implemented in such library. In same way you would require all ecto types have such support which does not makes sense especially if we are talking about complex combinations.

The better way is to create your own ecto type instead. Remember that you can reuse existing ecto callback implementations when defining your own cast, dump and load functions.

Eiji7 avatar Oct 25 '19 06:10 Eiji7