service/app/mix/dao/mongo_history.go

19 lines
383 B
Go

package dao
import (
"github.com/gin-gonic/gin"
"github.com/qiniu/qmgo"
"service/dbstruct"
)
// 历史记录
func (m *Mongo) getColHistory() *qmgo.Collection {
return m.clientMix.Database(DBHistory).Collection(COLHistory)
}
func (m *Mongo) WriteOneHistory(ctx *gin.Context, h *dbstruct.History) error {
col := m.getColHistory()
_, err := col.InsertOne(ctx, h)
return err
}