mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-06 22:53:35 +08:00
🐛 fix(metadata): 修复 Oracle 字段元数据显示缺失
- Oracle 元数据查询为字段名、类型、默认值、注释等列补齐稳定别名 - 新增字段定义归一化工具,兼容 name/Name/COLUMN_NAME 等返回形态 - 修复 DataGrid、DataViewer、QueryEditor、TableDesigner 对字段元数据的读取 - 补充 Oracle 字段注释、表头元数据和主键定位回归测试
This commit is contained in:
31
frontend/src/utils/columnDefinition.test.ts
Normal file
31
frontend/src/utils/columnDefinition.test.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
getColumnDefinitionComment,
|
||||
getColumnDefinitionKey,
|
||||
getColumnDefinitionName,
|
||||
getColumnDefinitionType,
|
||||
normalizeColumnDefinition,
|
||||
} from './columnDefinition';
|
||||
|
||||
describe('columnDefinition metadata normalization', () => {
|
||||
it('reads Go/Wails style column metadata fields', () => {
|
||||
const column = { Name: 'UPDATED_AT', Type: 'TIMESTAMP', Key: 'PRI', Comment: '更新时间' };
|
||||
|
||||
expect(getColumnDefinitionName(column)).toBe('UPDATED_AT');
|
||||
expect(getColumnDefinitionType(column)).toBe('TIMESTAMP');
|
||||
expect(getColumnDefinitionKey(column)).toBe('PRI');
|
||||
expect(getColumnDefinitionComment(column)).toBe('更新时间');
|
||||
});
|
||||
|
||||
it('reads Oracle dictionary style column metadata aliases', () => {
|
||||
const column = { COLUMN_NAME: 'UPDATED_AT', DATA_TYPE: 'TIMESTAMP', COLUMN_KEY: 'PRI', COMMENTS: '更新时间' };
|
||||
|
||||
expect(normalizeColumnDefinition(column)).toMatchObject({
|
||||
name: 'UPDATED_AT',
|
||||
type: 'TIMESTAMP',
|
||||
key: 'PRI',
|
||||
comment: '更新时间',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user