# ConfigCore **Repository Path**: thingple/configcore ## Basic Information - **Project Name**: ConfigCore - **Description**: 配置中台 - **Primary Language**: Go - **License**: MIT - **Default Branch**: develop - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 3 - **Created**: 2025-08-20 - **Last Updated**: 2025-09-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Config Core > 配置中心 ### 项目约束 ##### 数据库 table均以usc_*为前缀, 实现TableName函数 ### 目标 实现table类表格的表头动态控制(header alias), 配置系统独立运行,业务系统通过sdk集成api,提供UI集成模板。 提高开发效率。 ### 当前功能 1. 以项目为组管理表格 2. 配置表格字段的别名映射 ### 部署 #### 本地编译 1. 安装数据库服务(推荐使用PostgreSQL) 2. 运行镜像文件 3. 通过`config.toml`配置网络监听端口与数据库连接 ```toml web... ``` 4. 运行`./build_local.sh`脚本编译成可执行文件,或运行`./build.sh`脚本编译成Docker镜像 ### 使用 1. 使用浏览器进入配置页面,配置项目、表格与表格的字段别名映射 2. 项目中提供了sdk工具包,辅助调用api接口并内部实现了HTTP请求的缓存 ```go client := sdk.New( sdk.WithHost("http://localhost"), ) mapping, err := client.GetAliasMap("{table_code}") ``` - table_code: 表格编号,在配置页面创建表格时自动生成 - 返回值 mapping: `map[string]string`类型 3. 也可以通过HTTP请求`GET /api/flex_table/mappings/{table_code}`直接加载JSON格式的字段别名映射 - table_code: 表格编号,在配置页面创建表格时自动生成 - 响应: JSON ```json { "code": 200, "message": "查询成功", "data": { "code": "序列号", "createTime": "创建时间", "description": "个性化描述", "name": "名字的别名" } ``` 4. UI模板 1. 定义表格信息 ```ts const tableCode = "table_61bf245ce20d4cae9bc60977aacec82b"; // 1. table编号 const tableFields = ["id", "code", "name", "description", "createTime", "UpdateTime"] // 2. 表格字段列表 const tableFieldMap = ref(new Map()); // 3. 字段映射字典 ``` 2. 在html标签中使用 ```html ``` 3. 页面加载时,通过api加载映射表,然后与字段列表合并 ```ts getTableFieldAPi({code: tableCode}).then((res: any) => { if (res && res.data) { const map = new Map(Object.entries(res.data)); for (const field of state.tableFields) { if (!map.has(field) || map.get(field) === '') { map.set(field, field) } } state.tableFieldMap = map } }) ```