Comments (5)
目前项目没有提供sql文件,是因为使用了Grom库的自动迁移功能,具体代码位置在internal/storage/mysql/mysql.go
AutoMigrate 方法。
// New 根据MySQL选项去构建gorm对象
func New(opts *config.MySQLOptions) (*gorm.DB, error) {
dsn := fmt.Sprintf(`%s:%s@tcp(%s)/%s?charset=utf8&parseTime=%t&loc=%s`,
opts.Username,
opts.Password,
fmt.Sprintf("%s:%s", opts.Host, opts.Port),
opts.Database,
true,
"Local")
db, err := gorm.Open(mysql.Open(dsn), getConfig())
if err != nil {
return nil, err
}
sqlDB, err := db.DB()
if err != nil {
return nil, err
}
// 设置最多连接数
sqlDB.SetMaxOpenConns(opts.MaxOpenConnections)
// 设置最多可重用连接
sqlDB.SetConnMaxLifetime(opts.MaxConnectionLifeTime)
// 设置最多空闲连接池里的最多连接数
sqlDB.SetMaxIdleConns(opts.MaxIdleConnections)
err = db.AutoMigrate(model.Device{}, model.MediaDetail{}, model.Channel{})
return db, err
}
from go-gb28181.
感谢,已经找到了,以后多向大佬学习,为项目完善做一些贡献
from go-gb28181.
好的,我关闭issue了
from go-gb28181.
大佬有没有交流群啊
from go-gb28181.
大佬有没有交流群啊
还没有,目前功能和问题通过issue都还可以解决,后续太多了再考虑创建交流群沟通。
from go-gb28181.
Related Issues (6)
- 发送设备目录查询信息 不支持的命令 HOT 8
- 回放功能什么时候能更新? HOT 1
- 是否支持国标级联功能 HOT 3
- 这个如何使用呢?需要与ZLMediakit配合使用吗? HOT 1
- 有前端页面吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-gb28181.