workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

[Feature] Cf Kv batch get request

Open WERDXZ opened this issue 3 months ago • 1 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Description

The cf kv api support batch get since April. And it will be really helpful if we supports that.

I think a good api design will be changing this line

    pub fn get(&self, name: &str) -> GetOptionsBuilder {

to

    pub fn get(&self, name: &[&str]) -> GetOptionsBuilder {

WERDXZ avatar Oct 14 '25 23:10 WERDXZ

Since the "Request multiple keys" api does not support arrayBuffer and stream, the api will be a bit different I can think of four possible implementation, tell me which one is preferred lol

  1. separate function, just add a new function called batch_get or batch_read with a separate builder
  2. same function, but generic with type deduction (if input is a array slice, it will be returning a batch request builder)
  3. the value_type setter return an error (this will be a breaking change though)
  4. add a new variant to KvError, this will also be somehow breaking since we did not attribute it with non_exhaustive

WERDXZ avatar Oct 14 '25 23:10 WERDXZ