First release
This commit is contained in:
parent
d96cb05d63
commit
55822c6af2
20
docs/docusaurus/.gitignore
vendored
20
docs/docusaurus/.gitignore
vendored
@ -1,20 +0,0 @@
|
|||||||
# Dependencies
|
|
||||||
/node_modules
|
|
||||||
|
|
||||||
# Production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
.docusaurus
|
|
||||||
.cache-loader
|
|
||||||
|
|
||||||
# Misc
|
|
||||||
.DS_Store
|
|
||||||
.env.local
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
# Website
|
|
||||||
|
|
||||||
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
```
|
|
||||||
$ yarn
|
|
||||||
```
|
|
||||||
|
|
||||||
### Local Development
|
|
||||||
|
|
||||||
```
|
|
||||||
$ yarn start
|
|
||||||
```
|
|
||||||
|
|
||||||
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
|
|
||||||
|
|
||||||
### Build
|
|
||||||
|
|
||||||
```
|
|
||||||
$ yarn build
|
|
||||||
```
|
|
||||||
|
|
||||||
This command generates static content into the `build` directory and can be served using any static contents hosting service.
|
|
||||||
|
|
||||||
### Deployment
|
|
||||||
|
|
||||||
Using SSH:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ USE_SSH=true yarn deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
Not using SSH:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ GIT_USER=<Your GitHub username> yarn deploy
|
|
||||||
```
|
|
||||||
|
|
||||||
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"label": "Classes",
|
|
||||||
"position": 2,
|
|
||||||
"link": {
|
|
||||||
"type": "generated-index",
|
|
||||||
"description": "Here you can find all classes awSQL uses"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 9
|
|
||||||
---
|
|
||||||
|
|
||||||
# AlterTable
|
|
||||||
|
|
||||||
Alters a table.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`database` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a different database for this query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | Name of the database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### structure()
|
|
||||||
→ (`structure` = [Structure](./structure)) → `this`
|
|
||||||
|
|
||||||
The new desired structure for the table to get.
|
|
||||||
|
|
||||||
- Drops columns that are existing in the current table but not in the given structure
|
|
||||||
- Adds columns that are missing in the current table
|
|
||||||
- Modifies all other columns where at least one datatype is not matching
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `structure` | [Structure](./structure) | New structure definition for the table |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### execute()
|
|
||||||
`async` → () → __any__
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
[structure()](#structure) must always be given.
|
|
||||||
:::
|
|
||||||
|
|
||||||
Executes the prepared query.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Instance.checkStructure()](./instance#checkstructure) - Checks the structure afterwards and returns the check result
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 1
|
|
||||||
---
|
|
||||||
|
|
||||||
# awSQL
|
|
||||||
|
|
||||||
This is the default exported module that holds all Instances and manages them.
|
|
||||||
|
|
||||||
It does not provide any functionality on top of managing instances globally.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### createInstance()
|
|
||||||
→ (`hostname` = __String__, `username` = __String__, `password` = __String__, `options`? = \{`charset`?: __String__, `defaultDatabase`?: __String__, `multipleStatements`?: __Boolean__, `insecureAuth`?: __Boolean__, `customIdentifier`?: __String__, `isDefault`?: __Boolean__\}) → [Instance](./instance)
|
|
||||||
|
|
||||||
Creates a new instance to connect to a database.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `hostname` | __String__ | The hostname where the database is hosted |
|
|
||||||
| `username` | __String__ | Username to connect with |
|
|
||||||
| `password` | __String__ | Password |
|
|
||||||
| `options` __optional__ | __Object__ | Additional options |
|
|
||||||
| → `options.charset` __optional__ | __String__ | The charset to use |
|
|
||||||
| → `options.defaultDatabase` __optional__ | __String__ | The default database to select for queries |
|
|
||||||
| → `options.multipleStatements` __optional__ | __Boolean__ | Whether to allow multiple statements in a single query. Defaults to `false` |
|
|
||||||
| → `options.insecureAuth` __optional__ | __Boolean__ | Whether insecure authentication methods should be allowed. Defaults to `false` |
|
|
||||||
| → `options.customIdentifier` __optional__ | __String__ | Sets a custom identifier for this instance. Instances can be fetched by [getInstance()](#getInstance) with this identifier. If not set, the identifier will be "`username`@`hostname`" by default. |
|
|
||||||
| → `options.isDefault` __optional__ | __Boolean__ | Whether this instance is returned by default via [getInstance()](#getInstance) if the given identifier is empty or not retrievable |
|
|
||||||
|
|
||||||
:::warning Possible errors
|
|
||||||
This might crash if either of these situations happen:
|
|
||||||
|
|
||||||
- `password` is empty
|
|
||||||
- `username` is empty
|
|
||||||
- An instance with the same `identifier` already exists
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Instance](./instance)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### getInstance()
|
|
||||||
→ (`identifier`? = __String__) → [Instance](./instance) / __undefined__
|
|
||||||
|
|
||||||
Returns an already defined instance with the given `identifier`.
|
|
||||||
|
|
||||||
If a default instance was set it returns said instance if the `identifier` is empty.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `identifier` __optional__ | __String__ | The instance name to retrieve. Note: If not set with `options.customIdentifier` upon creation instances will be identified by "`username`@`hostname`".<br/> If not given it returns the defined default instance. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
- [Instance](./instance) - Instance was found
|
|
||||||
- __undefined__
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### listInstances()
|
|
||||||
→ () → __Array__\<__String__\>
|
|
||||||
|
|
||||||
Returns a list of defined instance identifiers
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Array__\<__String__\>
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### deleteInstance()
|
|
||||||
→ (`identifier` = __String__) → __true__
|
|
||||||
|
|
||||||
Deletes an instance and closes any open connection
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `identifier` __optional__ | __String__ | The instance to delete. Note: If not set with `options.customIdentifier` upon creation instances will be identified by "`username`@`hostname`". |
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
This might crash if either of these situations happen:
|
|
||||||
|
|
||||||
- `identifier` is empty
|
|
||||||
- To delete the default instance you must provide the `identifier` of the default instance.
|
|
||||||
- `identifier` is not of type __String__
|
|
||||||
- No instance with the given `identifier` was found
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __true__
|
|
||||||
|
|
||||||
:::info
|
|
||||||
Always returns true, as it will throw if any error happens to be sure any deletion was intended and correctly called.
|
|
||||||
:::
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 8
|
|
||||||
---
|
|
||||||
|
|
||||||
# CreateTable
|
|
||||||
|
|
||||||
Creates a new table with defined structure.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`database` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a different database for this query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | Name of the database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### name()
|
|
||||||
→ (`name` = __String__) → `this`
|
|
||||||
|
|
||||||
Sets the name of the new table.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name for the table |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### structure()
|
|
||||||
→ (`structure` = [Structure](./structure)) → `this`
|
|
||||||
|
|
||||||
The desired structure for the table to get.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `structure` | [Structure](./structure) | Structure for the table. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### execute()
|
|
||||||
`async` → () → __any__
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
[structure()](#structure) must always be given.
|
|
||||||
:::
|
|
||||||
|
|
||||||
Executes the prepared query.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - The result of 'CREATE TABLE [...]'-query
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,75 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 5
|
|
||||||
---
|
|
||||||
|
|
||||||
# Delete
|
|
||||||
|
|
||||||
Performs a query to delete rows from a table.
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
To prevent accidental deletion of all rows, this will throw an error on [execute()](#execute) if no [where()](#where) was defined.
|
|
||||||
|
|
||||||
To enable the deletion of all rows use [force()](#force).
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`database` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a different database for this query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | Name of the database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### where()
|
|
||||||
→ (`string` = __String__, `values` = __Array__\<__any__\>) → `this`
|
|
||||||
|
|
||||||
Adds a where-clause to the query
|
|
||||||
|
|
||||||
- Values should be set as ? in the string and given in left-to-right order via the 'values'-array to minimize the risk of sql-injection
|
|
||||||
- If you are using joins, specify the table and column together: table.column
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `string` | __String__ | The where-clause as a string with ? representing each values. |
|
|
||||||
| `values` | __Array__\<__any__\> | Array containing values replacing the ? in the string (from left to right) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### force()
|
|
||||||
→ () → `this`
|
|
||||||
|
|
||||||
Enables deletion of all rows.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### execute()
|
|
||||||
`async` → () → __any__
|
|
||||||
|
|
||||||
Executes the prepared query.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Query result
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 4
|
|
||||||
---
|
|
||||||
|
|
||||||
# Insert
|
|
||||||
|
|
||||||
Performs a query to insert new data into a table.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`database` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a different database for this query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | Name of the database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### data()
|
|
||||||
→ (`objects` = __Array__\<__Object__\>) → `this`
|
|
||||||
|
|
||||||
The data (rows) to insert.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `objects` | __Array__\<__Object__\> | Array containing objects to insert, where the key represent the column-name. All objects must have the same key-structure! |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### execute()
|
|
||||||
`async` → () → __any__
|
|
||||||
|
|
||||||
Executes the prepared query.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Query result
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,354 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
# Instance
|
|
||||||
|
|
||||||
Holds connection data and is the gateway to performing queries.
|
|
||||||
|
|
||||||
Instances can be managed via the default export [awSQL](./awsql)
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### connect()
|
|
||||||
`Promise` → () → __String__
|
|
||||||
|
|
||||||
Connects the instance.
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
Throws an error whenever the connection fails with an error
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __String__ - A connection string in the following format: "Connected to `host` with user `user`"
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### destroy()
|
|
||||||
→ () → __true__
|
|
||||||
|
|
||||||
Destroys the connection
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __true__
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### queryRaw()
|
|
||||||
`async` → (`queryString` = __String__, `values`? = __Array__\<__any__\>) → __any__
|
|
||||||
|
|
||||||
Performs a raw query with the given sql-string.
|
|
||||||
|
|
||||||
To prevent sql-injections use ? and push your values in order into the `values` array.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `queryString` | __String__ | The sql-query to perform |
|
|
||||||
| `values` | __Array__\<__any__\> | ? in the query string will be replaced by this values in order |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Whatever the query returns
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### getDatabases()
|
|
||||||
`async` → (`excludeSchema`? = __Boolean__) → __Array__\<__String__\>
|
|
||||||
|
|
||||||
Returns a list of database names the user has access to
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `excludeSchema` __option__ | __Boolean__ | Whether to exclude the default database 'information_schema' |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Array__\<__String__\>
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`name` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a default database for future queries
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | The database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### getTables()
|
|
||||||
→ (`database`? = __String__) → __Array__\<__String__\>
|
|
||||||
|
|
||||||
Returns a list of tables for the selected database
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
`options.multipleStatemens` must have been set to __true__ at creation of this instance for this to work. If not this will throw an error.
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` __optional__ | __String__ | Database to get tables of. Can be empty as long as a default database was set with 'selectDatabase' |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Array__\<__String__\>
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### select()
|
|
||||||
→ (`from` = __String__, `...columns`? = __String__) → [Select](./select)
|
|
||||||
|
|
||||||
Prepares a new select query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `from` | __String__ | Name of the table to select from |
|
|
||||||
| `...columns` __optional__ | __String__ | Names of the columns to include in the query. Leave empty to select all (`*`) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Select](./select)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### insert()
|
|
||||||
→ (`into` = __String__) → [Insert](./insert)
|
|
||||||
|
|
||||||
Prepares a new query to insert data.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `into` | __String__ | Name of the table to insert into |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Insert](./insert)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### delete()
|
|
||||||
→ (`from` = __String__) → [Delete](./delete)
|
|
||||||
|
|
||||||
Prepares a new query to delete data.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `from` | __String__ | Name of the table to delete from |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Delete](./delete)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### update()
|
|
||||||
→ (`table` = __String__) → [Update](./update)
|
|
||||||
|
|
||||||
Prepares a new query to update data.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `table` | __String__ | Name of the table to update data of |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Update](./update)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### dropDatabase()
|
|
||||||
`async` → (`database` = __String__) → __any__
|
|
||||||
|
|
||||||
Drops a whole database
|
|
||||||
- Requires admin privileges
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | The name of the database to drop |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Whatever the query result is
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### dropTable()
|
|
||||||
`async` → (`table` = __String__) → __any__
|
|
||||||
|
|
||||||
Drops a whole table.
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
A default database must be set with [selectDatabase()](#selectdatabase)
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `table` | __String__ | The name of the table to drop |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Whatever the query result is
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### createDatabase()
|
|
||||||
`async` → (`name` = __String__) → __any__
|
|
||||||
|
|
||||||
Creates a new database.
|
|
||||||
- Requires admin privileges
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | The name of the database to create |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Whatever the query result is
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### createTable()
|
|
||||||
→ (`name` = __String__) → [CreateTable](./create-table)
|
|
||||||
|
|
||||||
Prepares to create a new table.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | The name of the table to create |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [CreateTable](./create-table)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### alterTable()
|
|
||||||
→ (`name` = __String__) → [AlterTable](./alter-table)
|
|
||||||
|
|
||||||
Prepares to alter a table.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | The name of the table to alter |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [AlterTable](./alter-table)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### createStructure()
|
|
||||||
→ () → [Structure](./structure)
|
|
||||||
|
|
||||||
Creates a new structure.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Structure](./structure)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### getStructure()
|
|
||||||
`async` → (`table` = __String__, `database`? = __String__) → [Structure](./structure)
|
|
||||||
|
|
||||||
Returns the structure object of a table.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `table` | __String__ | The name of the table to get structure of |
|
|
||||||
| `database` __optional__ | __String__ | Name of the underlying database. Can be empty when a default database was set with [selectDatabase()](#selectdatabase) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ [Structure](./structure)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### checkStructure()
|
|
||||||
`async` → (`table` = __String__, `desiredStructure` = [Structure](./structure), `database`? = __String__) → __Object__
|
|
||||||
|
|
||||||
Checks the structure of a table against a given structure.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `table` | __String__ | The name of the table to check |
|
|
||||||
| `desiredStructure` | [Structure](./structure) | The structure to check against |
|
|
||||||
| `database` __optional__ | __String__ | Name of the underlying database. Can be empty when a default database was set with [selectDatabase()](#selectdatabase) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Object__
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
errors: [<...String>], // Holds error messages
|
|
||||||
passed: [<...String>] // Holds success messages
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
:::info
|
|
||||||
If `errors.length` is `0` the structure is correct
|
|
||||||
:::
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### total()
|
|
||||||
`async` → (`table` = __String__) → __Number__
|
|
||||||
|
|
||||||
Returns the total amount of rows of a table.
|
|
||||||
- A default database must be set
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `table` | __String__ | The name of the table to check. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Number__
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### isConnected()
|
|
||||||
→ () → __Boolean__
|
|
||||||
|
|
||||||
Returns whether the connection has been established.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Boolean__
|
|
||||||
@ -1,242 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 3
|
|
||||||
---
|
|
||||||
|
|
||||||
# Select
|
|
||||||
|
|
||||||
Performs a query to retrieve data from a table.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`database` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a different database for this query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | Name of the database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### distinct()
|
|
||||||
→ () → `this`
|
|
||||||
|
|
||||||
Adds the 'distinct' keyword to this query
|
|
||||||
|
|
||||||
- With 'distinct' only unique values are returned
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### where()
|
|
||||||
→ (`string` = __String__, `values` = __Array__\<__any__\>) → `this`
|
|
||||||
|
|
||||||
Adds a where-clause to the query
|
|
||||||
|
|
||||||
- Values should be set as ? in the string and given in left-to-right order via the 'values'-array to minimize the risk of sql-injection
|
|
||||||
- If you are using joins, specify the table and column together: table.column
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `string` | __String__ | The where-clause as a string with ? representing each values. |
|
|
||||||
| `values` | __Array__\<__any__\> | Array containing values replacing the ? in the string (from left to right) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### having()
|
|
||||||
→ (`string` = __String__, `values` = __Array__\<__any__\>) → `this`
|
|
||||||
|
|
||||||
Same as [where()](#where) but allows for aggregation.
|
|
||||||
|
|
||||||
- Values should be set as ? in the string and given in left-to-right order via the 'values'-array to minimize the risk of sql-injection
|
|
||||||
- If you are using joins, specify the table and column together: table.column
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `string` | __String__ | The having-clause with possible aggregation ? representing each values. |
|
|
||||||
| `values` | __Array__\<__any__\> | Array containing values replacing the ? in the string (from left to right) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### order()
|
|
||||||
→ (`column` = __String__, `desc` = __Boolean__, `aggregation` = __Enum__) → `this`
|
|
||||||
|
|
||||||
Adds a new sort order.
|
|
||||||
|
|
||||||
- Can be used multiple times to order by multiple columns
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `column` | __String__ | Column to order by |
|
|
||||||
| `desc` | __Boolean__ | Sort descending? Defaults to `false` |
|
|
||||||
| `aggregation` | __Enum__ → `MIN`/`MAX`/`COUNT`/`SUM`/`AVG` | The aggregation type to use |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### count()
|
|
||||||
→ (`doParse` = __Boolean__) → `this`
|
|
||||||
|
|
||||||
Counts the number of entries of the first selected column.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `doParse` | __Boolean__ | If `true` the query will only return a __Number__ of entries. Defaults to `false`. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### sum()
|
|
||||||
→ (`doParse` = __Boolean__) → `this`
|
|
||||||
|
|
||||||
Sums numerical rows of the first selected column.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `doParse` | __Boolean__ | If `true` the query will only return a __Number__ of entries. Defaults to `false`. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### avg()
|
|
||||||
→ (`doParse` = __Boolean__) → `this`
|
|
||||||
|
|
||||||
Averages numerical rows of the first selected column.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `doParse` | __Boolean__ | If `true` the query will only return a __Number__ of entries. Defaults to `false`. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### group()
|
|
||||||
→ (`...columns` = __String__) → `this`
|
|
||||||
|
|
||||||
Groups rows that have the same values into summary rows.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `...columns` | __String__ | The columns to group by |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### join()
|
|
||||||
→ (`type` = __Enum__, `table` = __String__, `onOriginalColumn` = __String__, `onJoinedColumn` = __String__, `...columns` = __String__) → `this`
|
|
||||||
|
|
||||||
Adds a new join to the query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `type` | __Enum__ → `LEFT`/`INNER`/`RIGHT`/`FULL OUTER` | The join type |
|
|
||||||
| `table` | __String__ | Table to join on |
|
|
||||||
| `onOriginalColumn` | __String__ | Column name on the original table to check agains |
|
|
||||||
| `onJoinedColumn` | __String__ | Column name of the join table to check against |
|
|
||||||
| `...columns` | __String__ | The columns to join. OG-columns must be set! |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### limit()
|
|
||||||
→ (`number` = __Number__, `offset` = __Number__) → `this`
|
|
||||||
|
|
||||||
Limits the query and specifies an offset to start at.
|
|
||||||
|
|
||||||
:::warning
|
|
||||||
`offset` has no default value and therefore must not be empty!
|
|
||||||
:::
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `number` | __Number__ | Limits the query by specified rows |
|
|
||||||
| `offset` | __Number__ | Offset to start at. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### pagination()
|
|
||||||
→ (`page` = __Number__, `itemsPerPage` = __Number__) → `this`
|
|
||||||
|
|
||||||
Paginates the query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `page` | __Number__ | The page to get (Minimum 1) |
|
|
||||||
| `itemsPerPage` | __Number__ | How many items a page should have |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### execute()
|
|
||||||
`async` → () → __any__
|
|
||||||
|
|
||||||
Executes the prepared query.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Query result
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,579 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 7
|
|
||||||
---
|
|
||||||
|
|
||||||
# Structure
|
|
||||||
|
|
||||||
Defines a new Table structure.
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### constructor()
|
|
||||||
→ (`tableDescription`? = __Array__\<[ColumnStructure](../typedefs/column-structure)\>) → `this`
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `tableDescription` __optional__ | __Array__\<[ColumnStructure](../typedefs/column-structure)\> | An array holding a list of column structure objects to define columns with.<br/><br/>You can get a `tableDescription` from a structure with the [get()](#get) method, store it and load it again by creating a [Structure](#structure) with it in this constructor. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### get()
|
|
||||||
→ () → __Array__\<[ColumnStructure](../typedefs/column-structure)\>
|
|
||||||
|
|
||||||
Returns an array containing all defined columns in the [ColumnStructure](../typedefs/column-structure) object.
|
|
||||||
|
|
||||||
With this you can save the structure and load it again by passing it to the [constructor](#constructor) of a new [Structure](#structure).
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __Array__\<[ColumnStructure](../typedefs/column-structure)\>
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### drop()
|
|
||||||
→ (`name` = __String__) → `this`
|
|
||||||
|
|
||||||
Drops (removes) a column from this structure.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | The column name to drop |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### char()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'char' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of characters to store in this column. <br/><br/>- _Min_: 0<br/>- _Max_: 255<br/>- _Default_: 1 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### varchar()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'varchar' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of characters to store in this column. <br/><br/>- _Min_: 0<br/>- _Max_: 255<br/>- _Default_: 1 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### binary()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'binary' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Default_: 1 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### varbinary()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'varbinary' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 0<br/>- _Default_: 1 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### tinyblob()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'tinyblob' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### tinytext()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'tinytext' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### text()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'text' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### blob()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'blob' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of characters to store in this column. <br/><br/>- _Min_: 0<br/>- _Max_: 65535<br/>- _Default_: 65535 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### mediumtext()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'mediumtext' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### longtext()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'longtext' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### longblob()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'longblob' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### enum()
|
|
||||||
→ (`name` = __String__, `vals`? = __Array__\<__String__\>, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'enum' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `vals` | __Array__\<__String__\> | Array of possible values for this column. |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### set()
|
|
||||||
→ (`name` = __String__, `vals`? = __Array__\<__String__\>, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'enum' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `vals` | __Array__\<__String__\> | Array of possible values for this column. |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### bit()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'bit' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Max_: 64<br/>- _Default_: 1 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### tinyint()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'tinyint' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Max_: 255<br/>- _Default_: 255 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### bool()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'bool' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### smallint()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'smallint' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Max_: 255<br/>- _Default_: 255 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### mediumint()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'mediumint' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Max_: 255<br/>- _Default_: 255 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### int()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'int' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Max_: 255<br/>- _Default_: 255 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### bigint()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'bigint' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Max_: 255<br/>- _Default_: 255 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### float()
|
|
||||||
→ (`name` = __String__, `p`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'float' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `p` __optional__ | __Number__ | Precision. <br/><br/>- _Min_: 1<br/>- _Max_: 53<br/>- _Default_: 25 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### double()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `d`? = __Number__ `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'double' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Default_: 16 |
|
|
||||||
| `d` __optional__ | __Number__ | Double precision. <br/><br/>- _Min_: 1<br/>- _Default_: 8 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### decimal()
|
|
||||||
→ (`name` = __String__, `size`? = __Number__, `d`? = __Number__ `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'decimal' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `size` __optional__ | __Number__ | Maximum length of data. <br/><br/>- _Min_: 1<br/>- _Default_: 16 |
|
|
||||||
| `d` __optional__ | __Number__ | Double precision. <br/><br/>- _Min_: 1<br/>- _Default_: 8 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### date()
|
|
||||||
→ (`name` = __String__,`options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'date' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### datetime()
|
|
||||||
→ (`name` = __String__, `fsp`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'datetime' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `fsp` __optional__ | __Number__ | Fractional second precision. <br/><br/>- _Min_: 0<br/>- _Max_: 6<br/>- _Default_: 0 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### timestamp()
|
|
||||||
→ (`name` = __String__, `fsp`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'timestamp' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `fsp` __optional__ | __Number__ | Fractional second precision. <br/><br/>- _Min_: 0<br/>- _Max_: 6<br/>- _Default_: 0 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### time()
|
|
||||||
→ (`name` = __String__, `fsp`? = __Number__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'time' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `fsp` __optional__ | __Number__ | Fractional second precision. <br/><br/>- _Min_: 0<br/>- _Max_: 6<br/>- _Default_: 0 |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### year()
|
|
||||||
→ (`name` = __String__, `options`? = [ConstraintOptions](../typedefs/constraint-options)) → `this`
|
|
||||||
|
|
||||||
Adds a new column of data type 'year' to this structure
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `name` | __String__ | Name of the column |
|
|
||||||
| `options` __optional__ | [ConstraintOptions](../typedefs/constraint-options) | Additional constraint options |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 6
|
|
||||||
---
|
|
||||||
|
|
||||||
# Update
|
|
||||||
|
|
||||||
Performs a query to update data in a table.
|
|
||||||
|
|
||||||
:::warning Possible crash
|
|
||||||
To prevent accidental update of all rows, this will throw an error on [execute()](#execute) if no [where()](#where) was defined.
|
|
||||||
|
|
||||||
To enable the update of all rows use [force()](#force).
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Methods
|
|
||||||
|
|
||||||
### data()
|
|
||||||
→ (`object` = __Object__) → `this`
|
|
||||||
|
|
||||||
Updates all matching rows with the given object.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `object` | __Object__ | The object with the data to update to. Keys represent column names. |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### selectDatabase()
|
|
||||||
→ (`database` = __String__) → `this`
|
|
||||||
|
|
||||||
Selects a different database for this query.
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `database` | __String__ | Name of the database to select |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### force()
|
|
||||||
→ () → `this`
|
|
||||||
|
|
||||||
Enables update of all rows.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### where()
|
|
||||||
→ (`string` = __String__, `values` = __Array__\<__any__\>) → `this`
|
|
||||||
|
|
||||||
Adds a where-clause to the query
|
|
||||||
|
|
||||||
- Values should be set as ? in the string and given in left-to-right order via the 'values'-array to minimize the risk of sql-injection
|
|
||||||
- If you are using joins, specify the table and column together: table.column
|
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| -- | -- | -- |
|
|
||||||
| `string` | __String__ | The where-clause as a string with ? representing each values. |
|
|
||||||
| `values` | __Array__\<__any__\> | Array containing values replacing the ? in the string (from left to right) |
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ `this`
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### execute()
|
|
||||||
`async` → () → __any__
|
|
||||||
|
|
||||||
Executes the prepared query.
|
|
||||||
|
|
||||||
**Returns**
|
|
||||||
|
|
||||||
→ __any__ - Query result
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 1
|
|
||||||
slug: /
|
|
||||||
---
|
|
||||||
|
|
||||||
# Introduction
|
|
||||||
|
|
||||||
:::info Not finished
|
|
||||||
This documentation is far from being finished.<br/>
|
|
||||||
It holds the most useful information, but lacks depth and examples.<br/>
|
|
||||||
It will be expanded in the near future.
|
|
||||||
:::
|
|
||||||
|
|
||||||
awSQL is a fast and reliable database query tool.
|
|
||||||
|
|
||||||
It is designed to minimize the risk of sql-injections while maximizing usability and safety.
|
|
||||||
|
|
||||||
It prevents you from altering a whole set of rows by accident.
|
|
||||||
|
|
||||||
awSQL is designed to programmatically work with databases in an obvious manner. No more writing pesky and confusing sql-queries
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
To get started all you need is:
|
|
||||||
|
|
||||||
- An hosted database
|
|
||||||
- Your credentials
|
|
||||||
- The `mysql` module from npm.
|
|
||||||
|
|
||||||
To install the `mysql` module, type:
|
|
||||||
|
|
||||||
```shell showLineNumbers
|
|
||||||
npm install mysql
|
|
||||||
```
|
|
||||||
|
|
||||||
→ Next move the /awSQL folder into your workspace.
|
|
||||||
|
|
||||||
Now you can access the default exports:
|
|
||||||
|
|
||||||
```js index.js showLineNumbers
|
|
||||||
const {awSQL, Structure} = require("./awSQL");
|
|
||||||
|
|
||||||
const instance = awSQL.createInstance("localhost", "myUser", "myPass");
|
|
||||||
instance.connect();
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
```
|
|
||||||
|
|
||||||
## Exports
|
|
||||||
|
|
||||||
awSQL exports 2 modules to use:
|
|
||||||
|
|
||||||
- [awSQL](./classes/awSQL) as an instance
|
|
||||||
- [Structure](./classes/structure)
|
|
||||||
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"label": "Typedefs",
|
|
||||||
"position": 2,
|
|
||||||
"link": {
|
|
||||||
"type": "generated-index",
|
|
||||||
"description": "Here you can find all type definitions used by awSQL"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,76 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 1
|
|
||||||
---
|
|
||||||
|
|
||||||
# ColumnStructure
|
|
||||||
|
|
||||||
`Object`
|
|
||||||
|
|
||||||
This defines a single column object used by [Structure](../classes/structure).
|
|
||||||
|
|
||||||
## Example structure
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
Field: "Column name",
|
|
||||||
Type: "Column type",
|
|
||||||
Null: "YES",
|
|
||||||
Key: "PRI",
|
|
||||||
Default: "Some default value",
|
|
||||||
Extra: ""
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
### .Field
|
|
||||||
→ __String__
|
|
||||||
|
|
||||||
The column name.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .Type
|
|
||||||
→ __String__
|
|
||||||
|
|
||||||
The column type.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .Null
|
|
||||||
→ __Enum__ → `YES`/`NO`
|
|
||||||
|
|
||||||
Whether the column allows null-values.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .Key
|
|
||||||
→ __Enum__ → ` `/`PRI`/`MUL`/`UNI`
|
|
||||||
|
|
||||||
Key-Values for the table.
|
|
||||||
|
|
||||||
- ` `(Empty) = None
|
|
||||||
- `PRI` = Primary
|
|
||||||
- `MUL` = Indexed
|
|
||||||
- `UNI` = Unique
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .Default
|
|
||||||
→ __String__ / __null__
|
|
||||||
|
|
||||||
Default value for a new row.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .Extra
|
|
||||||
→ __Enum__ → ` `/`auto_increment`
|
|
||||||
|
|
||||||
Extra values for the table.
|
|
||||||
|
|
||||||
- ` `(Empty) = None
|
|
||||||
- `auto_increment` = Primary key will be incremented on new data
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,86 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_position: 2
|
|
||||||
---
|
|
||||||
|
|
||||||
# ConstraintOptions
|
|
||||||
|
|
||||||
`Object`
|
|
||||||
|
|
||||||
An object used to define additional constraints for a column within a [Structure](../classes/structure).
|
|
||||||
|
|
||||||
:::info
|
|
||||||
All keys within this object are __optional__.
|
|
||||||
|
|
||||||
You only need to define the keys for the settings you want to enable.
|
|
||||||
|
|
||||||
Default values are always `false` on __Booleans__ or `""` on __Strings__
|
|
||||||
:::
|
|
||||||
|
|
||||||
## Example structure
|
|
||||||
|
|
||||||
```js
|
|
||||||
{
|
|
||||||
"primary": true,
|
|
||||||
"index": true,
|
|
||||||
"null": true,
|
|
||||||
"unique": true,
|
|
||||||
"default": "Some default text",
|
|
||||||
"auto_increment": false,
|
|
||||||
"unsigned": true
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Properties
|
|
||||||
|
|
||||||
### .primary
|
|
||||||
→ __Boolean__
|
|
||||||
|
|
||||||
Whether this column should be the primary one.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .index
|
|
||||||
→ __Boolean__
|
|
||||||
|
|
||||||
Whether this column should be indexable (Faster query, slower insertion)
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .null
|
|
||||||
→ __Boolean__
|
|
||||||
|
|
||||||
Whether this column is null per default
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .unique
|
|
||||||
→ __Boolean__
|
|
||||||
|
|
||||||
Whether this column data should be unique and block duplicate data.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .default
|
|
||||||
→ __String__
|
|
||||||
|
|
||||||
Sets the default data for this column that gets inserted if no data was given on insertion.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .auto_increment
|
|
||||||
→ __Boolean__
|
|
||||||
|
|
||||||
Whether this column should be numerical incremented on new insertions.
|
|
||||||
|
|
||||||
***
|
|
||||||
|
|
||||||
### .unsigned
|
|
||||||
→ __Boolean__
|
|
||||||
|
|
||||||
:::danger Warning
|
|
||||||
This option is only valid on numerical columns.
|
|
||||||
:::
|
|
||||||
|
|
||||||
Whether this column should be unsigned.
|
|
||||||
|
|
||||||
***
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
// `@type` JSDoc annotations allow editor autocompletion and type checking
|
|
||||||
// (when paired with `@ts-check`).
|
|
||||||
// There are various equivalent ways to declare your Docusaurus config.
|
|
||||||
// See: https://docusaurus.io/docs/api/docusaurus-config
|
|
||||||
|
|
||||||
import {themes as prismThemes} from 'prism-react-renderer';
|
|
||||||
|
|
||||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
|
||||||
|
|
||||||
/** @type {import('@docusaurus/types').Config} */
|
|
||||||
const config = {
|
|
||||||
title: 'awSQL Documentation',
|
|
||||||
tagline: 'Documentation for awesome Sequel',
|
|
||||||
favicon: 'img/favicon.ico',
|
|
||||||
|
|
||||||
// Set the production url of your site here
|
|
||||||
url: 'https://your-docusaurus-site.example.com',
|
|
||||||
// Set the /<baseUrl>/ pathname under which your site is served
|
|
||||||
// For GitHub pages deployment, it is often '/<projectName>/'
|
|
||||||
baseUrl: '/awSQL',
|
|
||||||
|
|
||||||
onBrokenLinks: 'throw',
|
|
||||||
onBrokenMarkdownLinks: 'warn',
|
|
||||||
|
|
||||||
// Even if you don't use internationalization, you can use this field to set
|
|
||||||
// useful metadata like html lang. For example, if your site is Chinese, you
|
|
||||||
// may want to replace "en" with "zh-Hans".
|
|
||||||
i18n: {
|
|
||||||
defaultLocale: 'en',
|
|
||||||
locales: ['en'],
|
|
||||||
},
|
|
||||||
|
|
||||||
presets: [
|
|
||||||
[
|
|
||||||
'classic',
|
|
||||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
|
||||||
({
|
|
||||||
docs: {
|
|
||||||
routeBasePath: '/'
|
|
||||||
},
|
|
||||||
theme: {
|
|
||||||
customCss: './src/css/custom.css',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
|
|
||||||
themeConfig:
|
|
||||||
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
|
|
||||||
({
|
|
||||||
// Replace with your project's social card
|
|
||||||
navbar: {
|
|
||||||
title: 'awSQL Documentation',
|
|
||||||
logo: {
|
|
||||||
alt: 'awSQL Logo',
|
|
||||||
src: 'img/logo512_transparent.png',
|
|
||||||
},
|
|
||||||
items: [],
|
|
||||||
},
|
|
||||||
footer: {
|
|
||||||
style: 'dark',
|
|
||||||
copyright: `Copyright © ${new Date().getFullYear()} awSQL by Sam`,
|
|
||||||
},
|
|
||||||
prism: {
|
|
||||||
theme: prismThemes.github,
|
|
||||||
darkTheme: prismThemes.dracula,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
export default config;
|
|
||||||
17938
docs/docusaurus/package-lock.json
generated
17938
docs/docusaurus/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "docusaurus",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"docusaurus": "docusaurus",
|
|
||||||
"start": "docusaurus start",
|
|
||||||
"build": "docusaurus build",
|
|
||||||
"swizzle": "docusaurus swizzle",
|
|
||||||
"deploy": "docusaurus deploy",
|
|
||||||
"clear": "docusaurus clear",
|
|
||||||
"serve": "docusaurus serve",
|
|
||||||
"write-translations": "docusaurus write-translations",
|
|
||||||
"write-heading-ids": "docusaurus write-heading-ids"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@docusaurus/core": "3.7.0",
|
|
||||||
"@docusaurus/preset-classic": "3.7.0",
|
|
||||||
"@mdx-js/react": "^3.0.0",
|
|
||||||
"clsx": "^2.0.0",
|
|
||||||
"prism-react-renderer": "^2.3.0",
|
|
||||||
"react": "^19.0.0",
|
|
||||||
"react-dom": "^19.0.0"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@docusaurus/module-type-aliases": "3.7.0",
|
|
||||||
"@docusaurus/types": "3.7.0"
|
|
||||||
},
|
|
||||||
"browserslist": {
|
|
||||||
"production": [
|
|
||||||
">0.5%",
|
|
||||||
"not dead",
|
|
||||||
"not op_mini all"
|
|
||||||
],
|
|
||||||
"development": [
|
|
||||||
"last 3 chrome version",
|
|
||||||
"last 3 firefox version",
|
|
||||||
"last 5 safari version"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
// @ts-check
|
|
||||||
|
|
||||||
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creating a sidebar enables you to:
|
|
||||||
- create an ordered group of docs
|
|
||||||
- render a sidebar for each doc of that group
|
|
||||||
- provide next/previous navigation
|
|
||||||
|
|
||||||
The sidebars can be generated from the filesystem, or explicitly defined here.
|
|
||||||
|
|
||||||
Create as many sidebars as you want.
|
|
||||||
|
|
||||||
@type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
|
|
||||||
*/
|
|
||||||
const sidebars = {
|
|
||||||
// By default, Docusaurus generates a sidebar from the docs folder structure
|
|
||||||
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
|
|
||||||
|
|
||||||
// But you can create a sidebar manually
|
|
||||||
/*
|
|
||||||
tutorialSidebar: [
|
|
||||||
'intro',
|
|
||||||
'hello',
|
|
||||||
{
|
|
||||||
type: 'category',
|
|
||||||
label: 'Tutorial',
|
|
||||||
items: ['tutorial-basics/create-a-document'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
|
|
||||||
export default sidebars;
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
import clsx from 'clsx';
|
|
||||||
import Heading from '@theme/Heading';
|
|
||||||
import styles from './styles.module.css';
|
|
||||||
|
|
||||||
const FeatureList = [
|
|
||||||
{
|
|
||||||
title: 'Easy to Use',
|
|
||||||
Svg: require('@site/static/img/undraw_docusaurus_mountain.svg').default,
|
|
||||||
description: (
|
|
||||||
<>
|
|
||||||
Docusaurus was designed from the ground up to be easily installed and
|
|
||||||
used to get your website up and running quickly.
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Focus on What Matters',
|
|
||||||
Svg: require('@site/static/img/undraw_docusaurus_tree.svg').default,
|
|
||||||
description: (
|
|
||||||
<>
|
|
||||||
Docusaurus lets you focus on your docs, and we'll do the chores. Go
|
|
||||||
ahead and move your docs into the <code>docs</code> directory.
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Powered by React',
|
|
||||||
Svg: require('@site/static/img/undraw_docusaurus_react.svg').default,
|
|
||||||
description: (
|
|
||||||
<>
|
|
||||||
Extend or customize your website layout by reusing React. Docusaurus can
|
|
||||||
be extended while reusing the same header and footer.
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
function Feature({Svg, title, description}) {
|
|
||||||
return (
|
|
||||||
<div className={clsx('col col--4')}>
|
|
||||||
<div className="text--center">
|
|
||||||
<Svg className={styles.featureSvg} role="img" />
|
|
||||||
</div>
|
|
||||||
<div className="text--center padding-horiz--md">
|
|
||||||
<Heading as="h3">{title}</Heading>
|
|
||||||
<p>{description}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function HomepageFeatures() {
|
|
||||||
return (
|
|
||||||
<section className={styles.features}>
|
|
||||||
<div className="container">
|
|
||||||
<div className="row">
|
|
||||||
{FeatureList.map((props, idx) => (
|
|
||||||
<Feature key={idx} {...props} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
.features {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 2rem 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.featureSvg {
|
|
||||||
height: 200px;
|
|
||||||
width: 200px;
|
|
||||||
}
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* Any CSS included here will be global. The classic template
|
|
||||||
* bundles Infima by default. Infima is a CSS framework designed to
|
|
||||||
* work well for content-centric websites.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* You can override the default Infima variables here. */
|
|
||||||
:root {
|
|
||||||
--ifm-color-primary: #2e8555;
|
|
||||||
--ifm-color-primary-dark: #29784c;
|
|
||||||
--ifm-color-primary-darker: #277148;
|
|
||||||
--ifm-color-primary-darkest: #205d3b;
|
|
||||||
--ifm-color-primary-light: #33925d;
|
|
||||||
--ifm-color-primary-lighter: #359962;
|
|
||||||
--ifm-color-primary-lightest: #3cad6e;
|
|
||||||
--ifm-code-font-size: 95%;
|
|
||||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For readability concerns, you should choose a lighter palette in dark mode. */
|
|
||||||
[data-theme='dark'] {
|
|
||||||
--ifm-color-primary: #25c2a0;
|
|
||||||
--ifm-color-primary-dark: #21af90;
|
|
||||||
--ifm-color-primary-darker: #1fa588;
|
|
||||||
--ifm-color-primary-darkest: #1a8870;
|
|
||||||
--ifm-color-primary-light: #29d5b0;
|
|
||||||
--ifm-color-primary-lighter: #32d8b4;
|
|
||||||
--ifm-color-primary-lightest: #4fddbf;
|
|
||||||
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 168 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 59 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
Loading…
x
Reference in New Issue
Block a user