cooked_module() = lee_storage:data(#mnode{metatypes = ordsets:set(atom()), metaparams = map()})
data() = lee_storage:data() | [lee_storage:data()]
key() = [node_id() | {'$child', term()} | '$children']
lee_module() = namespace()
metatype() = atom()
mnode() = {[metatype()], properties(), lee_module()} | {[metatype()], properties()}
model() = #model{metamodel = lee:cooked_module(), model = lee:cooked_module(), meta_class_idx = #{lee:metatype() => [lee:key()]}}
model_key() = [node_id() | '$children']
namespace() = #{node_id() => mnode() | namespace()}
node_id() = atom() | tuple() | integer()
patch() = lee_storage:patch(term())
properties() = #{atom() => term()}
type() = #type{id = lee:key(), refinement = map(), parameters = [lee:type()]} | atom() | {var, term()}
validate_result() = {ok, Warnings::[string()]} | {error, Errors::[term()], Warnings::[term()]}
| base_metamodel/0 | Model module containing basic metatypes:. |
| from_string/3 | |
| from_strings/3 | Temporary function, don't use it. |
| get/3 | Get a value from the config. |
| list/3 | List objects in Data that can match Key |
| meta_validate/1 | Equivalent to meta_validate(all, Model). |
| meta_validate/2 | Validate model itself against its metamodel. |
| namespace/2 | Put model to a namespace. |
| validate/2 | Equivalent to validate(all, Model, Data). |
| validate/3 | Validate Data against Model. |
base_metamodel() -> lee:module()
Model module containing basic metatypes:
value is a leaf node, i.e. a concrete value.
type of type typerefl:type():
Type of the value
default (optional):
Default value, if presentoneliner of type string() (optional, but highly desired):
One-sentence doc stringdoc of type string() (optional, but highly desired):
Long description using DocBook
markup
map denotes a container node that groups multiple values together.
key_elements of type [lee:key()]:
List of child element keys that identify the map. Optional,
defaults to []
from_string(Model::lee:model(), Key::lee:model_key(), String::string()) -> {ok, term()} | {error, string()}
from_strings(Model::lee:model(), Key::lee:model_key(), Strings::[string()]) -> {ok, [term()]} | {error, string()}
Temporary function, don't use it.
get(Model::lee:model() | lee:cooked_module(), Data::data(), Key::lee:key()) -> term()
Get a value from the config
The return value is guaranteed safe, as long asData has been
validated against the Model, and Key is a valid Model key
list(Model::model() | cooked_module(), Data::data(), Key::lee:key()) -> [lee:key()]
List objects in Data that can match Key
?children nodes in the key will be replaced with actual child
keys, e.g. list(Model, Data, [foo, ?children])will return
[[foo, ?lcl(1)], [foo, ?lcl(2)]]when map
[foo] contains
two children with keys 1 and 2.
meta_validate(Model::lee:model()) -> validate_result()
Equivalent to meta_validate(all, Model).
meta_validate(MetaTypes::[metatype()] | all, Model::lee:model()) -> validate_result()
Validate model itself against its metamodel. Useful for spotting bugs in the model definition
namespace(Key::lee:key(), M::lee:module()) -> lee:module()
Put model to a namespace.
namespace([foo, bar], A) is equivalent to #{foo => #{bar => A}}
validate(Model::lee:model(), Data::data()) -> validate_result()
Equivalent to validate(all, Model, Data).
validate(MetaTypes::[metatype()] | all, Model::lee:model(), Data::data()) -> validate_result()
Validate Data against Model. MetaTypes is a list of
metatypes that should be validated, or atom all
Generated by EDoc