MalteJanz / sw-sync-cli

CLI for fast and flexible data transfer between shopware and (CSV) files over API
MIT License
3 stars 3 forks source link

Add lookup utility functions inside scripts #6

Open MalteJanz opened 2 months ago

MalteJanz commented 2 months ago

To allow lookup of entity IDs like:

Option A

Make it generic and allow the script to call something like


let currency_id = lookup("currency", "isoCode", "EUR");

And that would do an API search-ids request and return the ID or run into an error / panic.

Cons of this approach:

Option B

Prefetch some common lookup values at startup and store them in a HashMap in memory. Then the script would still be fast

let currency_id = lookup_currency("EUR");

Cons of this approach: