Module z_model

Call models, direct or via MQTT.

Copyright © 2018 Marc Worrell

Authors: Marc Worrell (marc@worrell.nl).

Description

Call models, direct or via MQTT

Data Types

model_callback()

model_callback() = m_get | m_post | m_delete

model_name()

model_name() = binary() | atom()

opt_message()

opt_message() = mqtt_packet_map:mqtt_message() | undefined

path()

path() = [path_element()]

path_element()

path_element() = atom() | binary() | term()

verb()

verb() = get | post | delete

Function Index

call/5
callback/5
get_arg/3
get_module/2Find the model module in the module index.
payload_msg/1
publish/5
template_get/3Called by the compiled templates for a model lookup.

Function Details

call/5

call(Model::model_name(), Verb::verb(), Path::path(), Msg::opt_message(), Context::z:context()) -> {ok, term()} | {error, term()}

callback/5

callback(Model::model_name(), Verb::verb(), Path::path(), Msg::mqtt_packet_map:mqtt_message(), Context::z:context()) -> {ok, term()} | {error, term()}

get_arg/3

get_arg(Prop::atom(), Map::map() | undefined, Context::z:context()) -> term() | undefined

get_module/2

get_module(Name::atom() | binary(), Context::z:context()) -> {ok, module()} | {error, term()}

Find the model module in the module index. The model must be either an atom or a binary.

payload_msg/1

payload_msg(Payload::term()) -> opt_message()

publish/5

publish(Model::model_name(), Verb::verb(), Path::path(), Msg::opt_message(), Context::z:context()) -> {ok, term()} | {error, term()}

template_get/3

template_get(Path::path(), Model::model_name(), Context::z:context()) -> {ok, {term(), path()}} | {error, term()}

Called by the compiled templates for a model lookup.


Generated by EDoc