Pathex v0.1.0 Pathex View Source

This module contains macroses to be used by user

Link to this section Summary

Functions

Macro of three arguments which applies given function for item in the given path of given structure

Creates path for given structure

Macro of three arguments which sets the given value in the given path of given structure

Sigil for paths. Has only two modes: naive (default) and json. Naive paths should look like ~P["string"/:atom/1] Json paths should look like ~P[string/this_one_is_too/1/0]

Macro gets the value in the given path of the given structure

Creates composition of two paths

Link to this section Types

Link to this type

el_structure()

View Source
el_structure() :: map() | list() | Keyword.t() | tuple()
Link to this type

key_type()

View Source
key_type() :: :integer | :atom | :binary
Link to this type

result()

View Source
result() :: {:ok, any()} | {:error, any()} | :error
Link to this type

struct_type()

View Source
struct_type() :: :map | :keyword | :list | :tuple
Link to this type

t()

View Source
t() ::
  (:get
   | :set
   | :update,
   {el_structure()}
   | {el_structure(), any()}
   | {el_structure(), (any() -> any())} ->
     result())

Link to this section Functions

Link to this macro

over(path, struct, function)

View Source (macro)

Macro of three arguments which applies given function for item in the given path of given structure

Link to this macro

path(quoted, mod \\ 'naive')

View Source (macro)

Creates path for given structure

Example:

iex> x = 1
iex> mypath = path 1 / :atom / "string" / {"tuple?"} / x
Link to this macro

set(path, struct, value)

View Source (macro)

Macro of three arguments which sets the given value in the given path of given structure

Link to this macro

sigil_P(arg, mod)

View Source (macro)

Sigil for paths. Has only two modes: naive (default) and json. Naive paths should look like ~P["string"/:atom/1] Json paths should look like ~P[string/this_one_is_too/1/0]

Link to this macro

view(path, struct)

View Source (macro)

Macro gets the value in the given path of the given structure

Creates composition of two paths