feat: refactor type mapper.

This commit is contained in:
Bobo
2025-06-16 14:49:21 +08:00
parent a1b8326783
commit de36ab695d
6 changed files with 102 additions and 94 deletions

View File

@@ -1,10 +1,10 @@
package mapper
// Mapper defines the interface for converting between DTOs and models.
type Mapper[DTO any, MODEL any] interface {
// ToModel converts a DTO to a MODEL.
ToModel(*DTO) *MODEL
// Mapper defines the interface for converting between Data Transfer Objects (DTOs) and Database Entities.
type Mapper[DTO any, ENTITY any] interface {
// ToEntity converts a DTO to a Database Entity.
ToEntity(*DTO) *ENTITY
// ToDto converts a MODEL to a DTO.
ToDto(*MODEL) *DTO
// ToDTO converts a Database Entity to a DTO.
ToDTO(*ENTITY) *DTO
}