Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use @std/ulid to generate ULIDs in KV key space examples #611

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions deploy/kv/manual/key_space.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ to do this. This type of identifier encodes a UTC timestamp, is
lexicographically sortable and is cryptographically random by default:

```js
import { ulid } from "https://deno.land/x/ulid/mod.ts";
import { ulid } from "jsr:@std/ulid";

const kv = await Deno.openKv();

Expand All @@ -123,16 +123,14 @@ async function setUser(user) {
["users", "01H76YTWK5DM1G9TFR0Y5SCZQV"]; // Third user
```

Furthermore, you can generate ULIDs monotonically increasingly using a factory
function:
Furthermore, you can generate ULIDs monotonically increasingly using
`monotonicUlid` function:

```js
import { monotonicFactory } from "https://deno.land/x/ulid/mod.ts";

const ulid = monotonicFactory();
import { monotonicUlid } from "jsr:@std/ulid";

async function setUser(user) {
await kv.set(["users", ulid()], user);
await kv.set(["users", monotonicUlid()], user);
}
```

Expand Down
Loading