Methods
genIndex(fdSrc, fdIndex, optopt)
- Description:
由各資料表定義*.mjs檔產生資料表收集物件ds
- Source:
Example
import genIndex from 'w-data-collector/src/genIndex.mjs'
genIndex('./src/schema/tables', './src/schema', {})
// => genIndex done
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fdSrc |
String | 輸入各資料表定義*.mjs檔案所在資料夾 |
|||||||||||||||||
fdIndex |
String | 輸入產生index.mjs檔案需儲存至的資料夾,主要是跟各資料表定義*.mjs檔計算相對路徑供程式碼import用 |
|||||||||||||||||
opt |
Object |
<optional> |
{}
|
輸入設定物件,預設{} Properties
|
(async) genTestdata(ds, wo, optopt) → {Promise}
- Description:
由資料表收集物件ds與資料表控制物件wo產生測試資料,並儲存至資料庫
- Source:
Example
import genTestdata from 'w-data-collector/src/genTestdata.mjs'
import ds from './index.mjs'
import { woItems } from '../../server/mOrm.mjs'
genTestdata(ds, woItems, {})
// => genTestdata done
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ds |
Object | 輸入資料表收集物件,ds也就是import由genIndex產生的index.mjs,其內各key代表各資料表,值代表各資料表設定與操作函數例如settings、funNew或funTestAndSave等 |
||||||||||||||||||||||
wo |
Object | 輸入資料表控制物件,各key代表各資料表,值代表各資料表操作函數例如insert、save、del等 |
||||||||||||||||||||||
opt |
Object |
<optional> |
{}
|
輸入設定物件,預設{} Properties
|
Returns:
回傳Promise,resolve代表產生成功,reject代表產生失敗
- Type
- Promise