toDomainComment 将DAO评论转换为领域模型评论
(daoComment dao.Comment)
| 137 | |
| 138 | // toDomainComment 将DAO评论转换为领域模型评论 |
| 139 | func (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评论切片转换为领域模型评论切片 |
| 164 | func (c *commentRepository) toDomainSliceComments(daoComments []dao.Comment) []domain.Comment { |
no outgoing calls
no test coverage detected