Paper - Erwin

As in list all values in this DO?
4 Replies
Erwin
Erwin3y ago
Yes, exactly.. Here are a few snippets of an array I was writing earlier today
const results = await this.storage.list<Event>({ prefix: 'eventqueue::ulid::' })
const results = await this.storage.list<Event>({ prefix: 'eventqueue::ulid::' })
= fetch the whole array the adding to the array:
const key = `eventqueue::ulid::${this.ulid()}`
this.storage.put(key, event)
const key = `eventqueue::ulid::${this.ulid()}`
this.storage.put(key, event)
Getting the first item of the array is another list, but now with not just a prefix, but also a limit of 1 🙂
Paper
PaperOP3y ago
Ohhhh So you can add prefixes and list values with a prefix! Thats awesome! is this the cloudflare DO api? Is the example in typescript? btw, thank you for all the help
Erwin
Erwin3y ago
Yeah, that is the DO API and also yes to it being Typescript 🙂
Paper
PaperOP3y ago
Thanks 👍
Want results from more Discord servers?
Add your server