27 lines
429 B
Go
27 lines
429 B
Go
package dao
|
|
|
|
import (
|
|
"context"
|
|
"gitee.com/red-future---jilin-g/common/mongo"
|
|
"oss/consts"
|
|
"oss/model/entity"
|
|
)
|
|
|
|
var File = &file{
|
|
NoCache: false,
|
|
}
|
|
|
|
type file struct {
|
|
NoCache bool
|
|
}
|
|
|
|
func (d *file) SetNoCache() {
|
|
File.NoCache = true
|
|
}
|
|
|
|
// Insert 插入
|
|
func (d *file) Insert(ctx context.Context, entity *entity.File) (err error) {
|
|
_, err = mongo.DB().Insert(ctx, []interface{}{entity}, consts.FileCollection)
|
|
return
|
|
}
|