What is a changeset in phoenix elixir

From the documentation: Changesets allow filtering, casting, validation and definition of constraints when manipulating models.. There is an example of working with changesets in the introductory documentation in the Ecto module. The functions change/2 and cast/4 are the usual entry points for creating changesets, while the remaining functions are useful for manipulating them. Changesets are … Read more

What is Elixir Plug?

Is it an abstraction layer between the two Yes, exactly! Plug is meant to be a generic adapter for different web servers. Currently we support just Cowboy but there is work to support others. Plug also defines how different components should be plugged together. Similar to Rack in Ruby, WSGI in Python, Ring in Clojure, … Read more

Why is Elixir’s Access behaviour not a protocol?

As you’ve already mentioned, Access‘s implementation was changed to use Behaviours instead of Protocols. The reasoning was performance. Protocols are type/data based polymorphism, and are exclusive to Elixir. That means it lets you dispatch based on the data structure Behaviours are a typeless mechanism that don’t rely on a data structure, but the module as … Read more

What is =~ operator in elixir

It’s not documented on that page, but it’s documented in Kernel.=~/2 that when the RHS is a string, =~ checks if LHS contains RHS: iex(1)> “foo” =~ “f” true iex(2)> “foo” =~ “o” true It does not implicitly convert RHS to regex: iex(3)> “foo” =~ “.” false If RHS is a regular expression, returns true … Read more