Initial commit
This commit is contained in:
commit
c0cb826917
63 changed files with 2069 additions and 0 deletions
43
internal/application/mapper/user_result.go
Normal file
43
internal/application/mapper/user_result.go
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package mapper
|
||||
|
||||
import (
|
||||
"58team_blog/internal/application/common"
|
||||
"58team_blog/internal/application/queries"
|
||||
"58team_blog/internal/domain/entities"
|
||||
)
|
||||
|
||||
func CreateUserResultFromEntity(entity *entities.User) *common.UserResult {
|
||||
return &common.UserResult{
|
||||
Id: entity.Id,
|
||||
UserName: entity.UserName,
|
||||
Password: entity.Password,
|
||||
}
|
||||
}
|
||||
|
||||
func CreateUserResultListFromEntity(entityList []*entities.User) *common.UserResultList {
|
||||
var result common.UserResultList
|
||||
|
||||
for _, e := range entityList {
|
||||
result.Result = append(result.Result, CreateUserResultFromEntity(e))
|
||||
}
|
||||
|
||||
return &result
|
||||
}
|
||||
|
||||
func CreateUserFindByIdResultFromEntity(entity *entities.User) *queries.UserFindByIdResult {
|
||||
return &queries.UserFindByIdResult{
|
||||
Result: CreateUserResultFromEntity(entity),
|
||||
}
|
||||
}
|
||||
|
||||
func CreateUserFindByNameResultFromEntity(entity *entities.User) *queries.UserFindByNameResult {
|
||||
return &queries.UserFindByNameResult{
|
||||
Result: CreateUserResultFromEntity(entity),
|
||||
}
|
||||
}
|
||||
|
||||
func CreateUserGetAllResultFromEntity(entity_list []*entities.User) *queries.UserGetAllResult {
|
||||
return &queries.UserGetAllResult{
|
||||
Result: CreateUserResultListFromEntity(entity_list),
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue