Open Niedzwiedzw opened 2 years ago
is try_load
suit your needs?
When implementing BatchFn
, the load
method is not faillible. In my case, I need to do database calls that may fail. How are the errors expected to propagate? Return an empty HashMap
?
I feel we probably need another type TryBatchFn
with a try_load
method.
currently, in case of DB fail, return an empty map, like this test https://github.com/cksac/dataloader-rs/blob/master/tests/cached.rs#L177
However, it will only return error (key not found) without the root cause. But I think it should be sufficient for most cases.
shouldn't .load() return
Result<HashMap<_, _>>
rather than just the hashmap itself? this forces me to panic on failed db request...