forked from OtterMind/Chat2DB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.ts
More file actions
92 lines (82 loc) · 2.63 KB
/
Copy pathdatabase.ts
File metadata and controls
92 lines (82 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import { DatabaseTypeCode, TableDataType } from '@/constants';
export interface IDatabase {
name: string;
code: DatabaseTypeCode;
img: string;
icon: string;
}
export interface ITableHeaderItem {
dataType: TableDataType;
name: string;
autoIncrement: boolean | null; // 是否自增
columnSize: number | null; // 字段长度
comment: string | null; // 字段注释
decimalDigits: number | null; // 小数位
defaultValue: string | null; // 默认值
nullable: boolean | null; // 是否为空
primaryKey: boolean | null; // 是否为主键
}
export interface IManageResultData {
dataList: string[][];
headerList: ITableHeaderItem[];
description: string;
message: string;
sql: string;
originalSql: string;
success: boolean;
uuid?: string;
duration: number;
fuzzyTotal: string;
hasNextPage: boolean;
sqlType: 'SELECT' | 'UNKNOWN';
updateCount?: number; // 如果是修改的话。后端会返回修改的条数
canEdit?: boolean; // 返回的数据是否可以编辑
tableName?: string; // 如果可以编辑的话。后端会返回表名称。修改需要给后端传递表名
}
/** 查询结果 配置属性 */
export interface IResultConfig {
pageNo: number;
pageSize: number;
total: number | string;
hasNextPage: boolean;
}
/** 不同数据库支持的列字段类型 以及字符集 排列规则列表*/
export interface IDatabaseSupportField {
columnTypes: IColumnTypes[];
charsets: ICharset[];
collations: ICollation[];
indexTypes: IIndexTypes[];
defaultValues: IDefaultValue[];
}
/** 字段所对应的 字符集*/
export interface ICharset {
charsetName: string; // 字符集名称
defaultCollationName: string; // 字符集默认的排序规则
}
/** 排列规则*/
export interface ICollation {
collationName: string;
}
/** 索引的类型*/
export interface IIndexTypes {
typeName: string;
}
/** 不同数据库支持的列字段类型 以及支持调整的选项*/
export interface IColumnTypes {
typeName: string;
supportAutoIncrement: boolean; // 是否支持自增
supportCharset: boolean; // 是否支持字符集
supportCollation: boolean; // 是否支持排序规则
supportComments: boolean; // 是否支持注释
supportDefaultValue: boolean; // 是否支持默认值
supportExtent: boolean; // 是否支持扩展
supportLength: boolean; // 是否支持长度
supportNullable: boolean; // 是否支持为空
supportScale: boolean; // 是否支持小数位
supportValue: boolean; // 是否支持值
supportUnit: boolean; // 是否支持单位
}
/** 不同数据库支持不同的默认值 */
export interface IDefaultValue {
defaultValue: string; // 默认值
}