View Source CozyParams
Provides Ecto-like API for casting and validating params.
why-another-package
Why another package?
There are some packages in the community:
NAME | Based on Ecto? | Use Ecto-like API? |
---|---|---|
params | YES | NO |
maru_params | NO | NO |
tarams | NO | NO |
... |
But, they don't fit my requirements. The package in my dream should:
- be based on Ecto which is robust and battle-tested.
- use Ecto-like API, which eliminates friction when working on casting params and modeling data source at the same time.
installation
Installation
Add cozy_params
to your list of dependencies in mix.exs
:
def deps do
[
{:cozy_params, "~> 0.1.0"}
]
end
(Optional) And, it's encouraged to setup .formatter.exs
for cozy_params
:
[
import_deps: [
# ...
:cozy_params
],
# ...
]
overview
Overview
CozyParams
- provides macros for general usage.- For better integration with other libraries:
CozyParams.Schema
- the module at lowest level. Generally, you don't use it directly.
Visit HexDocs for more details.
which-module-should-i-use
Which module should I use?
- If you want to use
cozy_params
withphoenix
controllers, useCozyParams.PhoenixController
. - If you want to use
cozy_params
in other cases, useCozyParams
. - If you want to know how
cozy_params
works, exploreCozyParams.Schema
.
uhhh-i-don-t-like-it
uhhh... I don't like it
You can try:
Find more at hex.pm.
license
License
Apache License 2.0