Shared helpers for MishkaGervaz.Form.Web.DataLoader.
Two reasons these live outside the __using__ macro:
- Reuse across the macro and user overrides. A user module that
overrides
load_record/3(viause MishkaGervaz.Form.Web.DataLoader) can call any helper here without redefining it. - Smaller compiled bytecode per consumer. Each
useinjects ~150 lines of pure-data helpers — extracting them means they compile once in this module rather than into every consumer's beam.
Three functional groups:
- Field lookups & extraction (
find_field/2,extract_existing_files/2,extract_dependency_values/2,extract_defaults_to_field_values/1) — pure reads offState/Phoenix.HTML.Form. - File normalization (
normalize_file_list/1,normalize_file_info/1) — coerce upload payloads into%{filename: …}maps. - Coordination (
load_dependent_relations/3,load_readonly_relation_options/3) — dispatch through a consumer-supplied function or module sodefoverridablesemantics are preserved.
See MishkaGervaz.Form.Web.DataLoader,
MishkaGervaz.Form.Web.DataLoader.RecordLoader,
MishkaGervaz.Form.Web.DataLoader.RelationLoader,
MishkaGervaz.Form.Web.DataLoader.TenantResolver,
MishkaGervaz.Form.Web.DataLoader.HookRunner, and
MishkaGervaz.Form.Web.State.