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

Add lookup utility functions inside scripts #6

@MalteJanz

Description

@MalteJanz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions