Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Commit

Permalink
Merge c72096c into 26fd38c
Browse files Browse the repository at this point in the history
  • Loading branch information
imotai committed Jun 19, 2023
2 parents 26fd38c + c72096c commit 7eb8021
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ yarn add db3.js
## Use db3.js in action

```ts

const account = createRandomAccount()
const client = createClient('http://127.0.0.1:26619', '', account)
const nonce = await syncAccountNonce(client)
// create a database
const { db, result } = await createDocumentDatabase(client, 'desc')
const index: Index = {
path: '/city',
path: '/name',
indexType: IndexType.StringKey,
}
// create a collection
Expand All @@ -36,10 +37,14 @@ const { collection, result } = await createCollection(
const [txId, block, order] = await addDoc(collection, {
name: 'book1',
author: 'db3 developers',
id: '0x10b1b560b2fd9a66ae5bce29e5050ffcef6bcc9663d5d116e9877b6a4dda13aa',
tag:'web3',
time: 1686285013,
fee: 0.069781,
})
// query document
const query = '/[name = book1]'
const resultSet = await queryDoc<Book>(
collection,
query)
```

## Show Your Support
Expand Down

0 comments on commit 7eb8021

Please sign in to comment.