You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/internal/dao/comment.go

46 lines
1.2 KiB

3 years ago
package dao
import "github.com/rocboss/paopao-ce/internal/model"
3 years ago
func (d *dataServant) GetComments(conditions *model.ConditionsT, offset, limit int) ([]*model.Comment, error) {
3 years ago
return (&model.Comment{}).List(d.engine, conditions, offset, limit)
}
func (d *dataServant) GetCommentByID(id int64) (*model.Comment, error) {
3 years ago
comment := &model.Comment{
Model: &model.Model{
ID: id,
},
}
return comment.Get(d.engine)
}
func (d *dataServant) DeleteComment(comment *model.Comment) error {
3 years ago
return comment.Delete(d.engine)
}
func (d *dataServant) GetCommentCount(conditions *model.ConditionsT) (int64, error) {
3 years ago
return (&model.Comment{}).Count(d.engine, conditions)
}
func (d *dataServant) CreateComment(comment *model.Comment) (*model.Comment, error) {
3 years ago
return comment.Create(d.engine)
}
func (d *dataServant) CreateCommentReply(reply *model.CommentReply) (*model.CommentReply, error) {
3 years ago
return reply.Create(d.engine)
}
func (d *dataServant) GetCommentReplyByID(id int64) (*model.CommentReply, error) {
3 years ago
reply := &model.CommentReply{
Model: &model.Model{
ID: id,
},
}
return reply.Get(d.engine)
}
func (d *dataServant) DeleteCommentReply(reply *model.CommentReply) error {
3 years ago
return reply.Delete(d.engine)
}