mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 10:09:54 +08:00
模块化上传驱动,使用泛型优化工具库降低冗余
This commit is contained in:
22
server/internal/library/storager/config.go
Normal file
22
server/internal/library/storager/config.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package storager
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/model"
|
||||
)
|
||||
|
||||
var config *model.UploadConfig
|
||||
|
||||
func SetConfig(c *model.UploadConfig) {
|
||||
config = c
|
||||
}
|
||||
|
||||
func GetConfig() *model.UploadConfig {
|
||||
return config
|
||||
}
|
||||
|
||||
func GetModel(ctx context.Context) *gdb.Model {
|
||||
return g.Model("sys_attachment").Ctx(ctx)
|
||||
}
|
Reference in New Issue
Block a user