You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/10/11 06:26:17 UTC

[GitHub] [inlong] leezng commented on a diff in pull request #6135: [INLONG-5814][Dashboard] Supports setting the precision of a field when adding a table field

leezng commented on code in PR #6135:
URL: https://github.com/apache/inlong/pull/6135#discussion_r991861091


##########
inlong-dashboard/src/metas/sinks/sqlServer.tsx:
##########
@@ -20,36 +20,41 @@ import type { FieldItemType } from '@/metas/common';
 import EditableTable from '@/components/EditableTable';
 import { sourceFields } from './common/sourceFields';
 
-const sqlserverFieldTypes = [
-  'char',
-  'varchar',
-  'nchar',
-  'nvarchar',
-  'text',
-  'ntext',
-  'xml',
-  'BIGINT',
-  'BIGSERIAL',
-  'decimal',
-  'money',
-  'smallmoney',
-  'numeric',
-  'float',
-  'real',
-  'bit',
-  'int',
-  'tinyint',
-  'smallint',
-  'bigint',
-  'time',
-  'datetime',
-  'datetime2',
-  'smalldatetime',
-  'datetimeoffset',
-].map(item => ({
-  label: item,
-  value: item,
-}));
+const fieldTypesConf = {
+  CHAR: (m, d) => (1 <= m && m <= 8000 ? '' : '1-8000'),

Review Comment:
   It is recommended to use the prompt `1<m<10` instead of `1-10`, because there are 2 parameters (m/d) in part.



##########
inlong-dashboard/src/metas/sinks/sqlServer.tsx:
##########
@@ -20,36 +20,41 @@ import type { FieldItemType } from '@/metas/common';
 import EditableTable from '@/components/EditableTable';
 import { sourceFields } from './common/sourceFields';
 
-const sqlserverFieldTypes = [
-  'char',
-  'varchar',
-  'nchar',
-  'nvarchar',
-  'text',
-  'ntext',
-  'xml',
-  'BIGINT',
-  'BIGSERIAL',
-  'decimal',
-  'money',
-  'smallmoney',
-  'numeric',
-  'float',
-  'real',
-  'bit',
-  'int',
-  'tinyint',
-  'smallint',
-  'bigint',
-  'time',
-  'datetime',
-  'datetime2',
-  'smalldatetime',
-  'datetimeoffset',
-].map(item => ({
-  label: item,
-  value: item,
-}));
+const fieldTypesConf = {
+  CHAR: (m, d) => (1 <= m && m <= 8000 ? '' : '1-8000'),
+  VARCHAR: (m, d) => (1 <= m && m <= 8000 ? '' : '1-8000'),
+  NCHAR: (m, d) => (1 <= m && m <= 4000 ? '' : '1-4000'),
+  NVARCHAR: (m, d) => (1 <= m && m <= 4000 ? '' : '1-4000'),
+  TEXT: () => '',
+  NTEXT: () => '',
+  XML: () => '',
+  BIGINT: (m, d) => (1 <= m && m <= 20 ? '' : '1<=M<=20'),
+  BIGSERIAL: (m, d) => (1 <= m && m <= 20 ? '' : '1<=M<=20'),
+  DECIMAL: (m, d) => (1 <= m && m <= 38 && 0 <= d && d < m ? '' : '1<=M<=38,0<=D<M'),
+  MONEY: (m, d) => (1 <= m && m <= 15 && 1 <= d && d <= 4 ? '' : '1<=M<=15,1<=D<=4'),
+  SMALLMONEY: (m, d) => (1 <= m && m <= 7 && 1 <= d && d <= 4 ? '' : '1<=M<=7,1<=D<=4'),
+  NUMERIC: (m, d) => (1 <= m && m <= 38 && 1 <= d && d <= 4 ? '' : '1<=M<=38,-<=D<=4'),

Review Comment:
   `-<=D<=4`. It seems error



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org