gjaldon / ecto_enum

Ecto extension to support enums in models
MIT License
562 stars 131 forks source link

Dynamically add typespecs to be used with Dializer #72

Closed praveenperera closed 5 years ago

praveenperera commented 5 years ago

If I make a user status:

  defenum(UserStatusEnum,
    invited: 0,
    activated: 1,
    disabled: 2,
    deleted: 3
  )

And that automatically added the following typespec

@type t ::  :invited | :activated | :disabled | :deleted

I could then use UserStatusEnum.t() when annotating types in the codebase.

gjaldon commented 5 years ago

This was done by #84