Methods
connect(nameopt) → {Object}
Create new connection to database.
By accessing an attribute an existing table will be returned or a new one will be created.
See table class about how to do CRUD operations
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
name |
string |
<optional> |
":memory:" |
Returns:
new Alopex instance.
- Type
- Object
Examples
// Memory database
const dataSet = await connect()
const pk = await dataSet.myNewTableName.insert({'myNewColumnName': 'data'})
// File database
const dataSet = await connect('mydb.sqlite')
const pk = await dataSet.myNewTableName.insert({'myNewColumnName': 'data'})