All Projects → achedeuzot → ecto_commons

achedeuzot / ecto_commons

Licence: MIT license
Ecto common validators for Date, Time, URLs, Emails, PostalCodes, Phone Numbers, Luhn checks, etc.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to ecto commons

ecto trail
EctoTrail allows to store Ecto changeset changes in a separate audit_log table.
Stars: ✭ 51 (+54.55%)
Mutual labels:  hex, ecto
Mssqlex
Microsoft SQL Server Adapter for Elixir
Stars: ✭ 38 (+15.15%)
Mutual labels:  hex, ecto
Cloak
Elixir encryption library designed for Ecto
Stars: ✭ 413 (+1151.52%)
Mutual labels:  hex, ecto
Ecto mnesia
Ecto adapter for Mnesia Erlang term database.
Stars: ✭ 223 (+575.76%)
Mutual labels:  hex, ecto
ecto nested changeset
Helpers for manipulating nested Ecto changesets
Stars: ✭ 23 (-30.3%)
Mutual labels:  ecto, changeset
ecto profiler
Project for Ecto DB profiling
Stars: ✭ 16 (-51.52%)
Mutual labels:  hex, ecto
react-color
🎨 Is a tiny color picker widget component for React apps.
Stars: ✭ 50 (+51.52%)
Mutual labels:  hex
hex-rgba
Convert HEX to RGBA
Stars: ✭ 12 (-63.64%)
Mutual labels:  hex
contextual
🌈 Generate your Ecto contexts using this macro and eliminate boilerplate
Stars: ✭ 18 (-45.45%)
Mutual labels:  ecto
mongodb ecto
MongoDB adapter for Ecto
Stars: ✭ 348 (+954.55%)
Mutual labels:  ecto
mix script
A build tool which allows you to use mix packages in an elixir script
Stars: ✭ 16 (-51.52%)
Mutual labels:  hex
guardian trackable
A Guardian hook to track user sign ins.
Stars: ✭ 25 (-24.24%)
Mutual labels:  ecto
hierarch
Tree structure & hierarchy for ecto models with ltree(Postgres)
Stars: ✭ 30 (-9.09%)
Mutual labels:  ecto
go-rainbow
Golang Helper for beautiful CLI Applications
Stars: ✭ 86 (+160.61%)
Mutual labels:  hex
abacus
Abacus is a tool to simplify the handling of units
Stars: ✭ 22 (-33.33%)
Mutual labels:  hex
HexMate
High-performance hex encoding and decoding for .NET
Stars: ✭ 36 (+9.09%)
Mutual labels:  hex
link preview
Link preview elixir library
Stars: ✭ 17 (-48.48%)
Mutual labels:  hex
exqlite
An SQLite3 driver for Elixir
Stars: ✭ 128 (+287.88%)
Mutual labels:  ecto
colour
Validate colours.
Stars: ✭ 31 (-6.06%)
Mutual labels:  hex
elixir-revisionair ecto
A Revisionair adapter based on Ecto. Allows you to persist and keep track of revisions of your data structures in any of Ecto's supported databases.
Stars: ✭ 18 (-45.45%)
Mutual labels:  ecto

EctoCommons

Build Status Coverage Status Hex Version License

Ecto common helpers such as validators and formatters.

Installation

The package is available on hex, so it can be installed by adding ecto_commons to your list of dependencies in mix.exs:

def deps do
  [
    {:ecto_commons, "~> 0.3.3"}
  ]
end

Documentation is published on HexDocs and can be found at https://hexdocs.pm/ecto_commons.

Summary

The package contains common ecto helpers:

Changeset validators

  • EctoCommons.DateValidator:
    • validate_date(changeset, field, opts): validates an equality (with approximation), before or after a given date.
  • EctoCommons.DateTimeValidator
    • validate_datetime(changeset, field, opts): validates an equality (with approximation), before or after a given date time.
  • EctoCommons.TimeValidator
    • validate_time(changeset, field, opts): validates an equality (with approximation), before or after a given time.
  • EctoCommons.EmailValidator
    • validate_email(changeset, field, opts): validates emails. As there is no perfect validation possible, multiple options are available depending on your requirements. Can also reject temporary/burner emails.
  • EctoCommons.URLValidator
    • validate_url(changeset, field, opts): validates if an URL is correct. Here too, there is no perfection possible. Multiple options are available depending on the precision required.
  • EctoCommons.StringValidator
    • validate_has_prefix(changeset, field, opts): validates if a string starts with a given prefix. The prefix itself can depend on another field or on a dynamic value.
  • EctoCommons.PostalCodeValidator
    • validate_postal_code(changeset, field, opts): validates postal code formatting using regular expressions depending on the country. This only ensures the postal code "looks ok" but doesn't check it really exists (that will need a complete database of all postal codes worldwide).
  • EctoCommons.SocialSecurityValidator
    • validate_social_security(changeset, field, opts): validates social security numbers (SSN) depending on the country. This only validates french SSNs for now.
  • EctoCommons.LuhnValidator
    • validate_luhn(changeset, field, opts): validates a string with Luhn's algorithm such as credit card numbers and other administrative codes.
  • EctoCommons.PhoneNumberValidator
    • validate_phone_number(changeset, field, opts): validates a phone number using libphonenumber.

Changeset helpers

  • EctoCommons.Helpers
    • validate_many(changeset, field, opts): validates multiple fields with the same validation function as well as the same options.

Changelog

ecto_commons follows semantic versioning. See CHANGELOG.md for more information.

License

MIT. Please see LICENSE for licensing details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].