ElixirExtensions

A set of convenient extensions for developing services with Elixir/Phoenix

Installation

the package can be installed by adding elixir_extensions to your list of dependencies in mix.exs:

def deps do
[
{:elixir_extensions, "~> 0.1.0"}
]
end

Usage

Core(String,Map)

use ElixirExtensions # import core extentions
iex> underscore_keys(%{"helloWorld" => "elixirHi"})
%{"hello_world" => "elixirHi"}
iex> truncate("hello world", length: 5)
"he..."
iex> stringify_keys(%{hello: "world"})
%{"hello" => "world"}
iex> slugify("hello world")
"hello-world"
iex> slugify("Hello world", separator: "")
"helloworld"

Ecto

defmodule MyApp.Repo do
use Ecto.Repo,
otp_app: :petal_pro,
adapter: Ecto.Adapters.Postgres
use ElixirExtensions.Ecto.RepoExt # Add this line to your repo.
end
defmodule MyApp.Accounts.User do
use Ecto.Schema
import Ecto.Changeset
alias ElixirExtensions.Ecto.ChangesetExt # Add this line to your schema file.
...
end
import Ecto.Query, warn: false
alias ElixirExtensions.Ecto.QueryExt # Add this line to your Context module file.

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/elixir_extensions.