gjaldon
EctoEnum - Ecto extension to support enums in Ecto models
This library is for defining Ecto enums (which are Ecto.Types) backed by integer, string, or user-defined types storage. User-defined types only work with PostgreSQL at the moment.
Usage looks like:
# lib/my_app/ecto_enums.ex
import EctoEnum
defenum StatusEnum, registered: 0, active: 1, inactive: 2, archived: 3
Or like:
defmodule User do
use Ecto.Schema
schema "users" do
field :status, StatusEnum
end
end
To learn more, check it out on Github.
This library has just been updated to v1.3.0 to add features like useing and string-backed enums!
Hope you guys like it I and look forward to your feedback/comments!
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
I released Doggo, a collection of unstyled Phoenix components.
https://github.com/woylie/doggo
Features
Unstyled Phoenix components....
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
It’s not that it’s vocabulary is too advanced. It’s something worse.
I get lost trying to follow even a paragraph written by Claude. It’...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Would it be possible to have a function that we can call that checks the postgresql database’s Enum definition and makes sure it matches the
defenumdefinition, and if there are any inconsistencies then it would return back, say, a{:error, reason}where reason is a list of the inconsistencies so we can log it or error or whatever we want (in addition to other reason codes like theRepopassed in is failing or something,:okmeans successful and everything matches)?I have to match to a pre-existing type of a backend database so I’d like to make sure I stay in sync, especially as it updates (been bit once by this). ^.^
gjaldon
That would be a really useful function. Just added the issue for your request at Add function for checking if EctoEnum types match with Postgresql types · Issue #80 · gjaldon/ecto_enum · GitHub