StaticContext.Validate (StaticContext v0.1.0)

Copy Markdown View Source

Validation helpers used by the EEx templates in priv/templates/static_context/.

These functions are called at runtime from code generated by StaticContext. They guard against unknown struct keys in filter clauses like list_by/1 and get_by/1.

Summary

Functions

Validates that all keys in clauses are valid fields of struct_module.

Functions

validate_clauses!(struct_module, clauses)

@spec validate_clauses!(
  module(),
  keyword()
) :: :ok

Validates that all keys in clauses are valid fields of struct_module.

Raises ArgumentError listing unknown keys if any are found.