12345678910111213141516171819202122232425262728 |
- package mapper
- import (
- "github.com/dmitriygnatenko/internal/dto"
- "github.com/dmitriygnatenko/internal/models"
- )
- func ConvertTagModelsToDTO(m []models.Tag) []dto.TagDTO {
- res := make([]dto.TagDTO, 0, len(m))
- for i := range m {
- res = append(res, dto.TagDTO{
- ID: m[i].ID,
- URL: m[i].URL,
- Tag: m[i].Tag,
- })
- }
- return res
- }
- func ConvertTagFormToModel(form models.TagForm) models.Tag {
- return models.Tag{
- ID: form.ID,
- Tag: form.Tag,
- URL: form.URL,
- }
- }
|