@tauri-apps/plugin-sql
Classes
default
Database
The Database
class serves as the primary interface for
communicating with the rust side of the sql plugin.
Constructors
new default()
Parameters
Parameter | Type |
---|---|
path | string |
Returns
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/guest-js/index.ts#L29
Properties
Property | Type |
---|---|
path | string |
Methods
close()
close
Closes the database connection pool.
Parameters
Parameter | Type | Description |
---|---|---|
db ? | string | Optionally state the name of a database if you are managing more than one. Otherwise, all database pools will be in scope. |
Returns
Promise
<boolean
>
Example
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/guest-js/index.ts#L162
execute()
execute
Passes a SQL expression to the database for execution.
Parameters
Parameter | Type |
---|---|
query | string |
bindValues ? | unknown [] |
Returns
Example
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/guest-js/index.ts#L108
select()
select
Passes in a SELECT query to the database for execution.
Type parameters
Type parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
query | string |
bindValues ? | unknown [] |
Returns
Promise
<T
>
Example
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/guest-js/index.ts#L141
get()
get
A static initializer which synchronously returns an instance of the Database class while deferring the actual database connection until the first invocation or selection on the database.
Sqlite
The path is relative to tauri::path::BaseDirectory::App
and must start with sqlite:
.
Parameters
Parameter | Type |
---|---|
path | string |
Returns
Example
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/guest-js/index.ts#L72
load()
load
A static initializer which connects to the underlying database and
returns a Database
instance once a connection to the database is established.
Sqlite
The path is relative to tauri::path::BaseDirectory::App
and must start with sqlite:
.
Parameters
Parameter | Type |
---|---|
path | string |
Returns
Example
Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/sql/guest-js/index.ts#L48
Interfaces
QueryResult
Properties
© 2024 Tauri Contributors. CC-BY / MIT