app-cloudep-tweeting-service/internal/model/mongo/post_model.go

29 lines
647 B
Go
Raw Normal View History

2024-08-28 14:29:42 +00:00
package model
import (
"github.com/zeromicro/go-zero/core/stores/cache"
"github.com/zeromicro/go-zero/core/stores/monc"
)
var _ PostModel = (*customPostModel)(nil)
type (
// PostModel is an interface to be customized, add more methods here,
// and implement the added methods in customPostModel.
PostModel interface {
postModel
}
customPostModel struct {
*defaultPostModel
}
)
// NewPostModel returns a model for the mongo.
func NewPostModel(url, db, collection string, c cache.CacheConf) PostModel {
conn := monc.MustNewModel(url, db, collection, c)
return &customPostModel{
defaultPostModel: newDefaultPostModel(conn),
}
}