comment.go 882 字节
package repository

import "opp/models"

type ICommentRepository interface {
	GetCommentById(id int64) (v *models.Comment, err error)
	AddComment(m *models.Comment) (id int64, err error)
	GetComments(userId int64, sourceType int, sourceId int64, lastId int64, pageSize int) (v []*models.Comment, total int, err error)
}

var _ ICommentRepository = (*CommentRepository)(nil)

type CommentRepository struct{}

func (r *CommentRepository) GetCommentById(id int64) (v *models.Comment, err error) {
	return models.GetCommentById(id)
}

func (r *CommentRepository) AddComment(m *models.Comment) (id int64, err error) {
	return models.AddComment(m)
}

func (r *CommentRepository) GetComments(userId int64, sourceType int, sourceId int64, lastId int64, pageSize int) (v []*models.Comment, total int, err error) {
	return models.GetComments(userId, sourceType, sourceId, lastId, pageSize)
}