You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add name method to ObjectId, fixes#760
- Fix up worker-sandbox/wrangler.toml to get 'npx wrangler dev' to work (on macOS)
- Add SOME_SECRET to .dev.vars to fix /durable/:id endpoint
- Add handlers for /hello and /storage endpoints in export_durable_object.rs in order to test ObjectId::name()
* Use wasm_bindgen getter attribute to access 'name' property
* Add 'equals' method for ObjectId
---------
Co-authored-by: Guy Bedford <[email protected]>
Copy file name to clipboardExpand all lines: worker/src/durable.rs
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -176,6 +176,20 @@ impl ObjectId<'_> {
176
176
})
177
177
.map_err(Error::from)
178
178
}
179
+
180
+
/// The name that was used to create the `ObjectId` via [`id_from_name`](https://developers.cloudflare.com/durable-objects/api/namespace/#idfromname).
181
+
/// `None` is returned if the `ObjectId` was constructed using [`unique_id`](https://developers.cloudflare.com/durable-objects/api/namespace/#newuniqueid).
182
+
pubfnname(&self) -> Option<String>{
183
+
self.inner.name()
184
+
}
185
+
}
186
+
187
+
implPartialEqforObjectId<'_>{
188
+
/// Compare equality between two ObjectIds using [`equals`](<https://developers.cloudflare.com/durable-objects/api/id/#equals>).
189
+
/// <div class="warning">The equality check ignores the namespace.</div>
0 commit comments