MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / toDomainComment

Method toDomainComment

internal/repository/comment.go:139–161  ·  view source on GitHub ↗

toDomainComment 将DAO评论转换为领域模型评论

(daoComment dao.Comment)

Source from the content-addressed store, hash-verified

137
138// toDomainComment 将DAO评论转换为领域模型评论
139func (c *commentRepository) toDomainComment(daoComment dao.Comment) domain.Comment {
140 domainComment := domain.Comment{
141 Id: daoComment.Id,
142 UserId: daoComment.UserId,
143 Biz: daoComment.Biz,
144 BizId: daoComment.BizId,
145 PostId: daoComment.PostId,
146 Content: daoComment.Content,
147 CreatedAt: daoComment.CreatedAt,
148 UpdatedAt: daoComment.UpdatedAt,
149 Status: daoComment.Status,
150 }
151
152 if daoComment.PID.Valid {
153 domainComment.ParentComment = &domain.Comment{Id: daoComment.PID.Int64}
154 }
155
156 if daoComment.RootId.Valid {
157 domainComment.RootComment = &domain.Comment{Id: daoComment.RootId.Int64}
158 }
159
160 return domainComment
161}
162
163// toDomainSliceComments 将DAO评论切片转换为领域模型评论切片
164func (c *commentRepository) toDomainSliceComments(daoComments []dao.Comment) []domain.Comment {

Callers 3

GetTopCommentsReplyMethod · 0.95
toDomainSliceCommentsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected