Members
(static) contract :Object
Table contract
Type:
- Object
- Source:
pk_name
Get primary key field
- Source:
Methods
(async, static) create(name, options) → {Promise.<Table>}
Create table
Parameters:
Name | Type | Description |
---|---|---|
name |
table name | |
options |
table fields |
- Source:
Returns:
table
- Type
- Promise.<Table>
(async, static) create_from_csv(name, filePath) → {Promise.<({error: string}|{error: string}|{error: string}|{error: string}|{error: string}|{success: string}|{error: (string|string|*)})>}
Table Create from CSV
Parameters:
Name | Type | Description |
---|---|---|
name |
||
filePath |
- Source:
Returns:
- Type
- Promise.<({error: string}|{error: string}|{error: string}|{error: string}|{error: string}|{success: string}|{error: (string|string|*)})>
(async, static) find(where, selectopts) → {Promise.<*>}
Find Tables
Parameters:
Name | Type | Description |
---|---|---|
where |
where condition | |
selectopts |
options |
- Source:
Returns:
table list
- Type
- Promise.<*>
(async, static) find_with_external(where0, selectopts)
Find Tables including external tables
Parameters:
Name | Type | Description |
---|---|---|
where0 |
||
selectopts |
- Source:
Returns:
(async, static) findOne(where) → {Promise.<(*|Table|null)>}
Find one Table
Parameters:
Name | Type | Description |
---|---|---|
where |
where condition |
- Source:
Returns:
table or null
- Type
- Promise.<(*|Table|null)>
(async) countRows(where) → {Promise.<number>}
Count amount of rows in db table
Parameters:
Name | Type | Description |
---|---|---|
where |
- Source:
Returns:
- Type
- Promise.<number>
(async) create_history_table() → {Promise.<void>}
Create history table
- Source:
Returns:
- Type
- Promise.<void>
(async) delete() → {Promise.<void>}
Drop current table
- Source:
Returns:
- Type
- Promise.<void>
(async) deleteRows(where) → {Promise.<void>}
Delete rows from table
Parameters:
Name | Type | Description |
---|---|---|
where |
condition |
- Source:
Returns:
- Type
- Promise.<void>
(async) distinctValues(fieldnm) → {Promise.<*>}
Return distinct Values for column in table
????
Parameters:
Name | Type | Description |
---|---|---|
fieldnm |
- Source:
Returns:
- Type
- Promise.<*>
(async) drop_history_table() → {Promise.<void>}
Drop history table
- Source:
Returns:
- Type
- Promise.<void>
(async) enable_fkey_constraints() → {Promise.<void>}
Enable constraints
- Source:
Returns:
- Type
- Promise.<void>
(async) get_child_relations()
Get child relations for table
- Source:
Returns:
(async) get_history(id) → {Promise.<*>}
Get table history data
Parameters:
Name | Type | Description |
---|---|---|
id |
- Source:
Returns:
- Type
- Promise.<*>
(async) get_parent_relations(allow_double)
Get parent relations for table
Parameters:
Name | Type | Description |
---|---|---|
allow_double |
- Source:
Returns:
(async) getFields() → {Promise.<*>}
Get Fields list for table
- Source:
Returns:
- Type
- Promise.<*>
(async) getJoinedQuery(opts) → {Promise.<{values, sql: string}>}
Parameters:
Name | Type | Description |
---|---|---|
opts |
- Source:
Returns:
- Type
- Promise.<{values, sql: string}>
(async) getRow(where) → {Promise.<(null|*)>}
Get one row from table in db
Parameters:
Name | Type | Description |
---|---|---|
where |
- Source:
Returns:
- Type
- Promise.<(null|*)>
(async) getRows(where, selopts) → {Promise.<*>}
Get rows from Table in db
Parameters:
Name | Type | Description |
---|---|---|
where |
||
selopts |
- Source:
Returns:
- Type
- Promise.<*>
(async) import_csv_file(filePath, recalc_stored, skip_first_data_row) → {Promise.<({error: string}|{success: string})>}
Import CSV file to existing table
Parameters:
Name | Type | Description |
---|---|---|
filePath |
||
recalc_stored |
||
skip_first_data_row |
- Source:
Returns:
(async) import_json_file(filePath, skip_first_data_row) → {Promise.<({error: string}|{success: string})>}
Import JSON table description
Parameters:
Name | Type | Description |
---|---|---|
filePath |
||
skip_first_data_row |
- Source:
Returns:
(async) insertRow(v_in, _userid) → {Promise.<*>}
Insert row
Parameters:
Name | Type | Description |
---|---|---|
v_in |
||
_userid |
- Source:
Returns:
- Type
- Promise.<*>
(async) is_owner(user, row) → {Promise.<(string|null|*|boolean)>}
Check if user is owner of row
Parameters:
Name | Type | Description |
---|---|---|
user |
user | |
row |
table row |
- Source:
Returns:
- Type
- Promise.<(string|null|*|boolean)>
(async) owner_fieldname() → {Promise.<(string|null|*)>}
Get owner column name
- Source:
Returns:
- Type
- Promise.<(string|null|*)>
owner_fieldname_from_fields(fields) → {null|*}
Get owner column name
Parameters:
Name | Type | Description |
---|---|---|
fields |
fields list |
- Source:
Returns:
null or owner column name
- Type
- null | *
readFromDB(row) → {*}
Returns row with only fields that can be read from db (readFromDB flag)
Parameters:
Name | Type | Description |
---|---|---|
row |
- Source:
Returns:
- Type
- *
(async) rename(new_name) → {Promise.<void>}
Rename table
Parameters:
Name | Type | Description |
---|---|---|
new_name |
- Source:
Returns:
- Type
- Promise.<void>
(async) toggleBool(id, field_name) → {Promise.<void>}
????
Parameters:
Name | Type | Description |
---|---|---|
id |
||
field_name |
- Source:
Returns:
- Type
- Promise.<void>
(async) tryInsertRow(v, _userid) → {Promise.<({error}|{success: *})>}
Try to Insert row
Parameters:
Name | Type | Description |
---|---|---|
v |
||
_userid |
- Source:
Returns:
- Type
- Promise.<({error}|{success: *})>
(async) tryUpdateRow(v, id, _userid) → {Promise.<({error}|{success: boolean})>}
Try to Update row
Parameters:
Name | Type | Description |
---|---|---|
v |
||
id |
||
_userid |
- Source:
Returns:
- Type
- Promise.<({error}|{success: boolean})>
(async) update(new_table_rec) → {Promise.<void>}
Update Table description in _sc_table
Also creates / drops history table for table
Parameters:
Name | Type | Description |
---|---|---|
new_table_rec |
- Source:
Returns:
- Type
- Promise.<void>
(async) updateRow(v_in, id, _userid) → {Promise.<void>}
Update row
Parameters:
Name | Type | Description |
---|---|---|
v_in |
colums with values to update | |
id |
id value | |
_userid |
user id |
- Source:
Returns:
- Type
- Promise.<void>