29 lines
689 B
Go
29 lines
689 B
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"github.com/zeromicro/go-zero/core/stores/cache"
|
||
|
"github.com/zeromicro/go-zero/core/stores/monc"
|
||
|
)
|
||
|
|
||
|
var _ CommentModel = (*customCommentModel)(nil)
|
||
|
|
||
|
type (
|
||
|
// CommentModel is an interface to be customized, add more methods here,
|
||
|
// and implement the added methods in customCommentModel.
|
||
|
CommentModel interface {
|
||
|
commentModel
|
||
|
}
|
||
|
|
||
|
customCommentModel struct {
|
||
|
*defaultCommentModel
|
||
|
}
|
||
|
)
|
||
|
|
||
|
// NewCommentModel returns a model for the mongo.
|
||
|
func NewCommentModel(url, db, collection string, c cache.CacheConf) CommentModel {
|
||
|
conn := monc.MustNewModel(url, db, collection, c)
|
||
|
return &customCommentModel{
|
||
|
defaultCommentModel: newDefaultCommentModel(conn),
|
||
|
}
|
||
|
}
|