Skip to content

Commit

Permalink
docs: update README code
Browse files Browse the repository at this point in the history
  • Loading branch information
SegaraRai committed Jan 8, 2025
1 parent cf04e2a commit 52a512b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,16 @@ async function append() {
// If you don't want to handle conflicts, you can just do: `const [fi] = afi.generateKeyBetween(...indices);`.
for (const fi of afi.generateKeyBetween(...indices)) {
try {
const article = await prisma.article.create({
await prisma.article.create({
data: {
title: "Hello, world!",
content: "This is a test article.",
fi,
userId: 1,
},
});

return;
} catch (e) {
if (afi.isIndexConflictError(e)) {
// Conflict occurred. (the same operation has been performed simultaneously)
Expand Down Expand Up @@ -184,6 +186,8 @@ async function move() {
fi,
},
});

return;
} catch (e) {
if (afi.isIndexConflictError(e)) {
// Conflict occurred.
Expand Down

0 comments on commit 52a512b

Please sign in to comment.