Skip to content

Commit

Permalink
feat: impl dal (#192)
Browse files Browse the repository at this point in the history
## Summary by CodeRabbit

- **New Features**
- Introduced database abstraction layer (DAL) functionality, including
decorators for columns, tables, indexes, and data source qualification.
- Added extensive enumeration support for database-related properties
such as column formats, types, compression types, and more.
- Launched new classes for modeling database columns, indexes, and
tables.
- Provided utilities for managing column, index, and table information
in DAL entities.
- Enhanced DAL documentation with usage guidance and reference to
additional resources.
- **Documentation**
- Updated documentation to include guidance on using new DAL decorators
and runtime features.
- **Tests**
- Expanded test coverage to include new DAL functionalities and
decorators.
- **Chores**
	- Updated `.gitignore` to exclude `.node` files.
  • Loading branch information
killagu authored Mar 21, 2024
1 parent 01d9061 commit 1c7d145
Show file tree
Hide file tree
Showing 110 changed files with 8,799 additions and 36 deletions.
63 changes: 32 additions & 31 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [ 14, 16, 18, 20 ]
node-version: [ 16, 18, 20 ]
steps:
- name: Checkout Git Source
uses: actions/checkout@master
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [ 14, 16, 18, 20 ]
node-version: [ 16, 18, 20 ]
steps:
- name: Checkout Git Source
uses: actions/checkout@master
Expand Down Expand Up @@ -80,32 +80,33 @@ jobs:
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
Runner-windows:
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
node-version: [ 14, 16, 18, 20 ]
steps:
- name: Checkout Git Source
uses: actions/checkout@master

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install Npm
run: npm i -g npm@8

- name: Install Dependencies
run: npm i

- name: Continuous integration
run: npm run ci

- name: Code Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
# GitHub mysql service not support windows
# Runner-windows:
# runs-on: windows-latest
#
# strategy:
# fail-fast: false
# matrix:
# node-version: [ 16, 18, 20 ]
# steps:
# - name: Checkout Git Source
# uses: actions/checkout@master
#
# - name: Setup Node.js
# uses: actions/setup-node@v1
# with:
# node-version: ${{ matrix.node-version }}
#
# - name: Install Npm
# run: npm i -g npm@8
#
# - name: Install Dependencies
# run: npm i
#
# - name: Continuous integration
# run: npm run ci
#
# - name: Code Coverage
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ plugin/tegg/test/fixtures/apps/**/*.js
!standalone/standalone/test/fixtures/**/node_modules/**/*.js
!plugin/tegg/test/fixtures/**/node_modules
!plugin/config/test/fixtures/**/node_modules
.node
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ObjectInfo {
}

export interface MultiInstancePrototypeGetObjectsContext {
moduleName: string;
unitPath: string;
}

Expand Down
1 change: 1 addition & 0 deletions core/core-decorator/test/decorators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ describe('test/decorator.test.ts', () => {
};
assert.deepStrictEqual(PrototypeUtil.getMultiInstanceProperty(FooLogger, {
unitPath: 'foo',
moduleName: '',
}), expectObjectProperty);
});
});
Expand Down
5 changes: 5 additions & 0 deletions core/dal-decorator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `@eggjs/dal-decorator`

## Usage

Please read [@eggjs/tegg-dal-plugin](../../plugin/dal-plugin)
24 changes: 24 additions & 0 deletions core/dal-decorator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export * from './src/enum/CompressionType';
export * from './src/enum/InsertMethod';
export * from './src/enum/RowFormat';
export * from './src/enum/IndexType';
export * from './src/enum/ColumnType';

export * from './src/decorator/Index';
export * from './src/decorator/Table';
export * from './src/decorator/Column';
export * from './src/decorator/DataSourceQualifier';

export * from './src/util/ColumnInfoUtil';
export * from './src/util/IndexInfoUtil';
export * from './src/util/TableInfoUtil';

export * from './src/model/ColumnModel';
export * from './src/model/IndexModel';
export * from './src/model/TableModel';

export * from './src/type/DateSource';
export * from './src/type/Spatial';
export * from './src/type/SqlMap';
export * from './src/type/ColumnTsType';
export * from './src/type/MySql';
56 changes: 56 additions & 0 deletions core/dal-decorator/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "@eggjs/dal-decorator",
"version": "3.32.0",
"description": "tegg dal decorator",
"keywords": [
"egg",
"typescript",
"decorator",
"tegg",
"dal"
],
"main": "dist/index.js",
"files": [
"dist/**/*.js",
"dist/**/*.d.ts"
],
"typings": "dist/index.d.ts",
"scripts": {
"test": "cross-env NODE_ENV=test NODE_OPTIONS='--no-deprecation' mocha",
"clean": "tsc -b --clean",
"tsc": "npm run clean && tsc -p ./tsconfig.json",
"tsc:pub": "npm run clean && tsc -p ./tsconfig.pub.json",
"prepublishOnly": "npm run tsc:pub"
},
"author": "killagu <[email protected]>",
"license": "MIT",
"homepage": "https:/eggjs/tegg",
"bugs": {
"url": "https:/eggjs/tegg/issues"
},
"repository": {
"type": "git",
"url": "[email protected]:eggjs/tegg.git",
"directory": "core/dal-decorator"
},
"engines": {
"node": ">=14.0.0"
},
"dependencies": {
"lodash.snakecase": "^4.1.1",
"pluralize": "^7.0.0",
"@eggjs/tegg-common-util": "^3.32.0",
"@eggjs/core-decorator": "^3.32.0"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.4",
"cross-env": "^7.0.3",
"mocha": "^10.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}
}
Loading

0 comments on commit 1c7d145

Please sign in to comment.