Executes an import plan by creating categories and items.
Categories are created first (get-or-create pattern), then items are inserted with progress reporting back to the calling process.
Summary
Functions
Executes an import plan.
Types
@type import_result() :: %{ created: non_neg_integer(), errors: [{non_neg_integer(), String.t()}], categories_created: non_neg_integer(), manufacturers_created: non_neg_integer(), suppliers_created: non_neg_integer(), manufacturer_supplier_links_created: non_neg_integer() }
Functions
@spec execute(map(), String.t(), pid(), keyword()) :: import_result()
Executes an import plan.
Phase 1: get-or-create categories / manufacturers / suppliers
(column mode only — fixed-uuid modes skip phase 1 for the
corresponding entity). Phase 2: insert items, resolving
category_uuid / manufacturer_uuid per row from the lookups
built in phase 1 (or the fixed UUIDs). Phase 3: link
manufacturers↔suppliers (M:N). Sends {:import_progress, current, total} messages to notify_pid after each item.
Options
:language— language code for multilang import (e.g."et"):category_uuid— fixed category UUID to assign all items to:match_categories_across_languages— whentrue, the get-or-create lookup for column-mode category creation matches column values against every translation any existing category has, not just the current import language. Defaultfalse.:manufacturer_uuid— fixed manufacturer UUID to assign all items to (skips phase 1 manufacturer creation):supplier_uuid— fixed supplier UUID; in phase 3 this supplier is linked (M:N) to every distinct manufacturer the items in this import ended up assigned to