29 lines
647 B
Go
29 lines
647 B
Go
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),
|
|
}
|
|
}
|