Unexported unnecessary members

This commit is contained in:
Artyom Belousov 2021-02-07 15:58:50 +03:00
parent 4da8e94bcc
commit d8a295be75
14 changed files with 134 additions and 115 deletions

View file

@ -4,11 +4,19 @@ import (
"fmt"
)
func (f *Fetcher) FormatCardPrices(name string, prices []CardPrice) string {
func (f *Fetcher) GetFormattedCardPrices(name string) (string, error) {
prices, err := f.getPrices(name)
if err != nil {
return "", err
}
return f.formatCardPrices(name, prices), nil
}
func (f *Fetcher) formatCardPrices(name string, prices []scgCardPrice) string {
message := fmt.Sprintf("Оригинальное название: %v\n", name)
message += fmt.Sprintf("Результатов: %v\n", len(prices))
for i, v := range prices {
message += fmt.Sprintf("%v. %v", i+1, v.Format())
message += fmt.Sprintf("%v. %v", i+1, v.format())
}
return message
}