Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
apttap committed Aug 7, 2024
1 parent fe1f8c2 commit c3e3937
Show file tree
Hide file tree
Showing 271 changed files with 15,575 additions and 81,669 deletions.
23 changes: 9 additions & 14 deletions docs/_SpriteDatabase/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,23 @@ permalink: /SpriteDatabase/command.html
(**language: *ArcadeSupportedQueryLanguages*, command: *string*, parameters: *Record<string, unknown>***)

Executes a command on the target database. This method should only be used
for non-transactional, non-idempotent statements such as: `CREATE`, `ALTER`, or `DROP`.
for non-transactional, non-idempotent statements such as `CREATE`, `ALTER`, or `DROP`.

CRUD operations must be part of a transaction, otherwise changes will not persist.
Use the `SpriteTransaction.crud()` for this purpose.
CRUD operations must be part of a transaction; otherwise, changes will not persist.
Use the `SpriteTransaction.crud()` method for this purpose.

If you are trying to execute idempotent commands see `SpriteDatabase.query()`.
If you need to execute idempotent commands, see `SpriteDatabase.query()`.

##### Note

---

This package includes type definitions to help you issue commands with typed return values.
> ###### Note:
> This package includes type definitions to help you issue commands with typed return values.
```ts
db.command<CreateDocumentType>(
'sql',
'CREATE document TYPE DocumentType'
'CREATE DOCUMENT TYPE aType'
);
```

---

#### Example

```ts
Expand All @@ -51,7 +46,7 @@ async function spriteCommandExample() {
try {
const result = await db.command<CreateDocumentType>(
'sql',
'CREATE document TYPE aType',
'CREATE DOCUMENT TYPE aType',
);
console.log(result);
// [ { operation: 'create document type', typeName: 'aType' } ]
Expand All @@ -60,7 +55,7 @@ async function spriteCommandExample() {
// handle error conditions
console.error(error);
}
};
}

spriteCommandExample();
```
Expand Down
6 changes: 3 additions & 3 deletions docs/_SpriteDatabase/constructor.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permalink: /SpriteDatabase/constructor.html

(**params: *ISpriteDatabaseNewSession***)

Interact with a database, perform queries, issue commands to manage
Interacts with a database, performing queries and issuing commands to manage
records, types, and settings.

#### Example
Expand All @@ -38,7 +38,7 @@ type DocumentTypes = {
}

async function databaseExample() {
const client = db.documents<DocumentTypes>();
const client = db.documents<DocumentTypes>();
try {
await db.transaction(async (trx) => {
await db.createType('aDocument', trx);
Expand All @@ -48,7 +48,7 @@ async function databaseExample() {
console.log(schema);
// [...]
} catch (error) {
console.log(error);
console.error(error);
// handle error conditions
}
}
Expand Down
9 changes: 6 additions & 3 deletions docs/_SpriteDatabase/explain.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
---

layout: default

title: explain

permalink: /SpriteDatabase/explain.html

---

### _SpriteDatabase_.explain

#### Interface

(**sql: _string_**)
(**sql: *string***)

Returns information about query execution planning of a specific statement,
without executing the statement itself.
Expand All @@ -27,7 +29,7 @@ const db = new SpriteDatabase({

async function spriteExplainExample() {
try {
const explanation = await db.explain('SELECT FROM schema:types');
const explanation = await db.explain("SELECT FROM schema:types");
console.log(explanation);
// {
// executionPlan: {
Expand All @@ -44,7 +46,8 @@ async function spriteExplainExample() {
console.error(error);
// handle error conditions
}
}
};

spriteExplainExample();
```

9 changes: 2 additions & 7 deletions docs/_SpriteDatabase/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ and `MATCH`.
If you are trying to execute
non-idempotent commands, see the SpriteDatabase.command method.

##### Note

---

This library includes type definitions to assist in writing queries with
> ###### Note:
> This library includes type definitions to assist in writing queries with
typed return values. For example: `ArcadeDocument`, `ArcadeEdge`, etc.
You can use these like so:

Expand All @@ -39,8 +36,6 @@ const result = await db.query<ArcadeDocument<DocumentType>>(
);
```

---

#### Example

```ts
Expand Down
19 changes: 19 additions & 0 deletions docs/_SpriteDatabase/setCredentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---

layout: default

title: setCredentials

permalink: /SpriteDatabase/setCredentials.html

---

### _SpriteDatabase_.setCredentials

#### Interface

(**username: *string*, password: *string***)

Set the credentials that the database client should use
when interacting with the ArcadeDB server.

Loading

0 comments on commit c3e3937

Please sign in to comment.