mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 13:46:00 +00:00
This commit is contained in:
1
packages/tools/.gitignore
vendored
Normal file
1
packages/tools/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
lib
|
||||
26
packages/tools/package.json
Normal file
26
packages/tools/package.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"version": "0.1.0",
|
||||
"name": "@dbgate/tools",
|
||||
"main": "lib/index.js",
|
||||
"typings": "lib/index.d.ts",
|
||||
"scripts": {
|
||||
"prepare": "yarn build",
|
||||
"build": "tsc",
|
||||
"start": "tsc --watch",
|
||||
"test": "jest"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@dbgate/types": "^0.1.0",
|
||||
"@types/node": "^13.7.0",
|
||||
"jest": "^24.9.0",
|
||||
"ts-jest": "^25.2.1",
|
||||
"typescript": "^3.7.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.15",
|
||||
"moment": "^2.24.0"
|
||||
}
|
||||
}
|
||||
27
packages/tools/src/commonTypeParser.ts
Normal file
27
packages/tools/src/commonTypeParser.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export function isTypeInteger(dataType) {
|
||||
return dataType && /int/i.test(dataType);
|
||||
}
|
||||
|
||||
export function isTypeNumeric(dataType) {
|
||||
return dataType && /numeric|decimal/i.test(dataType);
|
||||
}
|
||||
|
||||
export function isTypeFloat(dataType) {
|
||||
return dataType && /float|single|double/i.test(dataType);
|
||||
}
|
||||
|
||||
export function isTypeNumber(dataType) {
|
||||
return isTypeInteger(dataType) || isTypeFloat(dataType) || isTypeNumeric(dataType);
|
||||
}
|
||||
|
||||
export function isTypeString(dataType) {
|
||||
return dataType && /char/i.test(dataType);
|
||||
}
|
||||
|
||||
export function isTypeLogical(dataType) {
|
||||
return dataType && /bit|boolean/i.test(dataType);
|
||||
}
|
||||
|
||||
export function isTypeDateTime(dataType) {
|
||||
return dataType && /date|time/i.test(dataType);
|
||||
}
|
||||
1
packages/tools/src/index.ts
Normal file
1
packages/tools/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './commonTypeParser';
|
||||
14
packages/tools/tsconfig.json
Normal file
14
packages/tools/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2015",
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "lib",
|
||||
"preserveWatchOutput": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user