package village type CreateDto struct { District_Code string `json:"district_code" validate:"numeric;maxLength=6"` Code string `json:"code" validate:"numeric;maxLength=10"` Name string `json:"name" validate:"alphaSpace;maxLength=50"` } type ReadListDto struct { District_Code string `json:"district_code"` Code string `json:"code"` Name string `json:"name"` Page int `json:"page"` PageSize int `json:"page_size"` NoPagination int `json:"no_pagination"` } type ReadDetailDto struct { Id uint32 `json:"id"` District_Code string `json:"district_code"` Code string `json:"code"` Name string `json:"name"` } type UpdateDto struct { Id uint32 `json:"id"` CreateDto } type DeleteDto struct { Id uint32 `json:"id"` } type MetaDto struct { PageNumber int `json:"page_number"` PageSize int `json:"page_size"` Count int `json:"count"` } type ResponseDto struct { Id uint32 `json:"id"` District_Code string `json:"district_code"` Code string `json:"code"` Name string `json:"name"` } func (d Village) ToResponse() ResponseDto { resp := ResponseDto(d) return resp } func ToResponseList(data []Village) []ResponseDto { resp := make([]ResponseDto, len(data)) for i, u := range data { resp[i] = u.ToResponse() } return resp }