convert.go 814 Bytes
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
package handler

import (
	"google.golang.org/protobuf/types/known/timestamppb"
	"hilo/api/service/country"
	"hilo/app/service/country/internal/model"
)

func CountryModelToShortNameRep(m *model.ResCountry) *country.GetCountryByShortNameRep {
	return &country.GetCountryByShortNameRep{
		Data: &country.CountryModel{
			Id:                m.Id,
			Name:              m.Name,
			ShortName:         m.ShortName,
			Code:              m.Code,
			Icon:              m.Icon,
			Icon2:             m.Icon2,
			Lang:              m.Lang,
			IsCommon:          int32(m.IsCommon),
			IsDefault:         int32(m.IsDefault),
			Status:            int32(m.Status),
			CreatedTime:       timestamppb.New(m.CreatedTime),
			UpdatedTime:       timestamppb.New(m.UpdatedTime),
			StandardShortName: m.StandardShortName,
		},
	}
}