This commit is contained in:
Jan Prochazka
2020-06-18 21:18:30 +02:00
parent ac9bd62ecf
commit cecb88f024
13 changed files with 90 additions and 234 deletions

1
packages/tools/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
lib

View 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"
}
}

View 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);
}

View File

@@ -0,0 +1 @@
export * from './commonTypeParser';

View File

@@ -0,0 +1,14 @@
{
"compilerOptions": {
"target": "ES2015",
"module": "commonjs",
"declaration": true,
"skipLibCheck": true,
"outDir": "lib",
"preserveWatchOutput": true,
"esModuleInterop": true
},
"include": [
"src/**/*"
]
}