Astarte.Flow.Blocks.JsonPathMapper.JsonTemplate (astarte_flow v0.1.0)

Implements a simple logic less templating system that allows to write map templates with a syntax that resembles mustache syntax, that can be used for JSON templating.

Link to this section Summary

Link to this section Types

Link to this opaque

compiled_item()

(opaque)
@opaque compiled_item()
Link to this opaque

compiled_template()

(opaque)
@opaque compiled_template()
Link to this type

rendered_template()

@type rendered_template() ::
  template_base_type()
  | [rendered_template()]
  | %{optional(String.t()) => rendered_template()}
@type template() ::
  template_base_type() | [template()] | %{optional(String.t()) => template()}
Link to this type

template_base_type()

@type template_base_type() :: String.t() | number() | boolean() | nil

Link to this section Functions

Link to this function

compile_template(template_list)

@spec compile_template(template()) :: {:ok, compiled_template()} | {:error, any()}
Link to this function

render(template, input)

@spec render(compiled_template(), any()) ::
  {:ok, rendered_template()} | {:error, any()}