feat(db): 添加对达梦数据库的支持

- 在应用程序中新增对达梦数据库(DM)的配置和连接支持
- 实现 SetDmDB 函数以配置达梦数据库连接
- 更新数据库操作逻辑,支持达梦特有的 SQL 语法和功能
- 在相关文件中添加达梦数据库的处理逻辑,包括表创建、数据插入和查询
- 更新 go.mod 和 go.sum 文件以引入达梦数据库驱动
- 增强文档,详细说明达梦数据库的配置和使用方法
This commit is contained in:
2026-03-20 10:46:51 +08:00
parent 7ab803c5cc
commit b43f968b6c
194 changed files with 211502 additions and 2328 deletions
+48
View File
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2000-2018, 达梦数据库有限公司.
* All rights reserved.
*/
package i18n
import (
"encoding/json"
"golang.org/x/text/language"
"golang.org/x/text/message"
)
type msg struct {
Id string `json:"id"`
Translation string `json:"translation,omitempty"`
}
type i18n struct {
Language string `json:"language"`
Messages []msg `json:"messages"`
}
func InitConfig(jsonStr string) {
var i18n i18n
json.Unmarshal([]byte(jsonStr), &i18n)
msaArry := i18n.Messages
tag := language.MustParse(i18n.Language)
for _, e := range msaArry {
message.SetString(tag, e.Id, e.Translation)
}
}
func Get(key string, locale int) string {
var p *message.Printer
switch locale {
case 0:
p = message.NewPrinter(language.SimplifiedChinese)
case 1:
p = message.NewPrinter(language.AmericanEnglish)
case 2:
p = message.NewPrinter(language.TraditionalChinese)
}
return p.Sprintf(key)
}