Apply .gitignore rules

This commit is contained in:
皮蛋13361098506
2025-01-06 16:21:36 +08:00
parent 1b77f62820
commit ccd2c530cf
580 changed files with 69806 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
<root>
<!-- 是否是调试模式 -->
<DEBUG>true</DEBUG>
<!-- web服务监听地址和端口 -->
<WerbServerAddress>192.168.50.85:10051</WerbServerAddress>
<!-- es地址 -->
<EsUrls>http://10.252.0.70:18099</EsUrls>
<!-- 数据库配置 -->
<DbConfig>
<AdminDB>
<!-- 最大处于开启状态的连接数 -->
<MaxOpenConns>0</MaxOpenConns>
<!-- 最大处于空闲状态的连接数 -->
<MaxIdleConns>0</MaxIdleConns>
<!-- 数据库连接字符串 -->
<ConnectionString><![CDATA[root:Qq5201530300@tcp(192.168.50.110:3306)/admin?charset=utf8&parseTime=true&loc=Local&timeout=30s&multiStatements=true]]></ConnectionString>
</AdminDB>
<UserDB>
<!-- 最大处于开启状态的连接数 -->
<MaxOpenConns>0</MaxOpenConns>
<!-- 最大处于空闲状态的连接数 -->
<MaxIdleConns>0</MaxIdleConns>
<!-- 数据库连接字符串 -->
<ConnectionString><![CDATA[root:Qq5201530300@tcp(192.168.50.110:3306)/user?charset=utf8&parseTime=true&loc=Local&timeout=30s&multiStatements=true]]></ConnectionString>
</UserDB>
<RedisConfig>
<!-- 数据库连接字符串 -->
<ConnectionString>192.168.50.110:6379</ConnectionString>
<!-- 密码,如果要设置用户Id则密码设置为:"UserId:Password" -->
<Password></Password>
<!-- 数据库序号 -->
<Database>5</Database>
<!-- 最大活跃连接数 -->
<MaxActive>500</MaxActive>
<!-- 最大空闲的连接数 -->
<MaxIdle>200</MaxIdle>
<!-- 连接空闲超时时间,单位:秒 -->
<IdleTimeout>300</IdleTimeout>
<!-- 连接超时时间,单位:秒 -->
<DialConnectTimeout>10</DialConnectTimeout>
</RedisConfig>
</DbConfig>
</root>

View File

@@ -0,0 +1,62 @@
package main
import (
"fmt"
"github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
"Framework/dataSyncMgr/mysqlSync"
"goutil/logUtil"
)
var _ = mysql.DeregisterLocalFile
var (
connectionString = "root:moqikaka3309@tcp(10.1.0.10:3309)/develop_liujun?charset=utf8&parseTime=true&loc=Local&timeout=60s"
maxOpenConns = 10
maxIdleConns = 10
syncFileSize = 1024 * 1024
)
var (
// 数据库对象
dbObj *gorm.DB
// 同步管理对象
syncMgr *mysqlSync.SyncMgr
)
func init() {
// 初始化数据库连接
dbObj = initMysql()
// 构造同步管理对象
syncMgr = mysqlSync.NewLogSyncMgr(1, "Sync", syncFileSize, dbObj.DB())
}
// 初始化Mysql
func initMysql() *gorm.DB {
dbObj, err := gorm.Open("mysql", connectionString)
if err != nil {
panic(fmt.Errorf("初始化数据库:%s失败错误信息为%s", connectionString, err))
}
logUtil.DebugLog(fmt.Sprintf("连接mysql:%s成功", connectionString))
if maxOpenConns > 0 && maxIdleConns > 0 {
dbObj.DB().SetMaxOpenConns(maxOpenConns)
dbObj.DB().SetMaxIdleConns(maxIdleConns)
}
return dbObj
}
// 注册同步对象
func registerSyncObj(identifier string) {
syncMgr.RegisterSyncObj(identifier)
}
// 保存sql数据
func save(identifier string, command string) {
syncMgr.Save(identifier, command)
}