generated from PenaSide/GolangTemplate
24 lines
671 B
Go
24 lines
671 B
Go
![]() |
package transfer
|
||
|
|
||
|
import (
|
||
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/models"
|
||
|
"penahub.gitlab.yandexcloud.net/pena-services/customer/internal/proto/discount"
|
||
|
)
|
||
|
|
||
|
func TariffsToProductInformations(tarrifs []models.Tariff) []*discount.ProductInformation {
|
||
|
productInformations := make([]*discount.ProductInformation, len(tarrifs))
|
||
|
|
||
|
for index, tariff := range tarrifs {
|
||
|
productInformations[index] = TariffToProductInformation(tariff)
|
||
|
}
|
||
|
|
||
|
return productInformations
|
||
|
}
|
||
|
|
||
|
func TariffToProductInformation(tarrif models.Tariff) *discount.ProductInformation {
|
||
|
return &discount.ProductInformation{
|
||
|
ID: tarrif.ID,
|
||
|
Price: float64(tarrif.Price),
|
||
|
}
|
||
|
}
|