2025-12-26 13:59:02 +08:00
|
|
|
package dao
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"gitee.com/red-future---jilin-g/common/mongo"
|
|
|
|
|
"oss/consts"
|
|
|
|
|
"oss/model/entity"
|
|
|
|
|
)
|
|
|
|
|
|
2025-12-29 14:42:56 +08:00
|
|
|
var File = &file{
|
|
|
|
|
NoCache: false,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type file struct {
|
|
|
|
|
NoCache bool
|
|
|
|
|
}
|
2025-12-26 13:59:02 +08:00
|
|
|
|
2025-12-29 14:42:56 +08:00
|
|
|
func (d *file) SetNoCache() {
|
|
|
|
|
File.NoCache = true
|
|
|
|
|
}
|
2025-12-26 13:59:02 +08:00
|
|
|
|
|
|
|
|
// Insert 插入
|
|
|
|
|
func (d *file) Insert(ctx context.Context, entity *entity.File) (err error) {
|
2025-12-30 10:13:11 +08:00
|
|
|
_, err = mongo.DB().Insert(ctx, []interface{}{entity}, consts.FileCollection)
|
2025-12-26 13:59:02 +08:00
|
|
|
return
|
|
|
|
|
}
|