article.go
1.4 KB
package domain
import (
"context"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
type Article struct {
Id int64 `json:"id"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
DeletedAt *time.Time `json:"deletedAt"`
AuthorId int64 `json:"authorId"` // 发布人
Author UserSimple `json:"author"` // 发布人
Title string `json:"title"` // 文章标题
Images []Image `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Tags []int `json:"tags"` // 标签
// ...more
}
type ArticleRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Article, error)
}