Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Add lookup utility functions inside scripts #6

Open
MalteJanz opened this issue Jun 30, 2024 · 0 comments
Open

Add lookup utility functions inside scripts #6

MalteJanz opened this issue Jun 30, 2024 · 0 comments

Comments

@MalteJanz
Copy link
Owner

MalteJanz commented Jun 30, 2024

To allow lookup of entity IDs like:

  • currency by ISO code
  • language by locale code
  • ...

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:

  • Slows down everything massively.
    • We could try to cache / memoize the results, but still expensive to lookup single unique values
  • Might not work for everything easily (like languages with their locale association)

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:

  • You might miss some use case the user of the tool need
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant