Feat: Generic Api for Kv batch get (non breaking) #843
Feat: Generic Api for Kv batch get (non breaking) #843WERDXZ wants to merge 1 commit intocloudflare:mainfrom
Conversation
guybedford
left a comment
There was a problem hiding this comment.
Thank you for posting the PR, this is great!
The backwards compat work is impressive, but I think it is absolutely fine for Rust to treat this as an entirely separate function like batch_get, which should significantly simplify the approach and remove the generics tricks. As much as possible we should always try to give a direct translation of the JS APIs without too much magic.
Please let me know if you're able to post a follow-on further? Thanks.
|
I can create a separate Would you prefer:
|
|
I wonder if it might make sense to make a breaking change here actually, and simply require This would require an explicit use of let options = KvOptionsBuilder::new();
options.cache_ttl(...);
kv::get_key("foo", options.build())I don't think that would be too unidiomatic? The closer we can get the JS, the less pain we will have maintaining these, as opposed to trying to solve complex generics... |
|
Just to make sure, we want to make the api similar to I think the We can either make the The reason why I previously did those generic stuff is to imitate the behavior of |
Yeah, perhaps then just a very simple generic on the type being a |
I have to do some workarounds, like marking the
GetValueTypepublic, but I hide them in the doc lolResolve #842