mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 21:46:00 +00:00
This commit is contained in:
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';
|
||||
Reference in New Issue
Block a user