Class: SqlJsDatabaseAdapter
An abstract class representing a database adapter for managing various entities like accounts, memories, actors, goals, and rooms.
Hierarchy
-
↳
SqlJsDatabaseAdapter
Constructors
constructor
• new SqlJsDatabaseAdapter(db
): SqlJsDatabaseAdapter
Parameters
Name | Type |
---|---|
db | Database |
Returns
Overrides
Properties
db
• db: Database
Methods
addParticipant
▸ addParticipant(user_id
, room_id
): Promise
<boolean
>
Adds a user as a participant to a specific room.
Parameters
Name | Type | Description |
---|---|---|
user_id | `${string}-${string}-${string}-${string}-${string}` | The UUID of the user to add as a participant. |
room_id | `${string}-${string}-${string}-${string}-${string}` | The UUID of the room to which the user will be added. |
Returns
Promise
<boolean
>
A Promise that resolves to a boolean indicating success or failure.
Overrides
DatabaseAdapter.addParticipant
countMemories
▸ countMemories(room_id
, unique?
, tableName?
): Promise
<number
>
Counts the number of memories in a specific room.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
room_id | `${string}-${string}-${string}-${string}-${string}` | undefined | The UUID of the room for which to count memories. |
unique | boolean | true | Specifies whether to count only unique memories. |
tableName | string | "" | Optional table name to count memories from. |
Returns
Promise
<number
>
A Promise that resolves to the number of memories.
Overrides
createAccount
▸ createAccount(account
): Promise
<boolean
>
Creates a new account in the database.
Parameters
Name | Type | Description |
---|---|---|
account | Account | The account object to create. |