Pathex v0.2.0 Pathex View Source
This module contains macroses to be used by user
Any macro here belongs to one of two categories:
1) Macro which creates path closure (sigil_P/2
, path/2
, ~>/2
)
2) Macro which uses path closure as path (over/3
, set/3
, view/2
)
Path closure is a closure which takes two arguments:
1) Atom.t()
with operaion name
2) Tuple.t()
of arguments of this operation
Link to this section Summary
Functions
Macro of three arguments which sets the given value in the given path of given structure
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
t()
View Sourcet() :: (:get | :set | :update, {el_structure()} | {el_structure(), any()} | {el_structure(), (any() -> any())} -> result())
Link to this section Functions
Macro of three arguments which sets the given value in the given path of given structure
If the path does not exist it creates the path favouring maps when structure is unknown
Macro of three arguments which applies given function for item in the given path of given structure
Creates path for given structure
Example:
iex> x = 1
iex> mypath = path 1 / :atom / "string" / {"tuple?"} / x
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