mchstest/cmd/mtparse/main.go
2023-01-19 19:20:20 +10:00

33 lines
765 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package main
import (
"encoding/json"
"os"
"gitstore.ru/tolikproh/mchstest/internal/model"
"gitstore.ru/tolikproh/mchstest/pkg/util"
)
func main() {
var inTest []model.MTType
var outTest []model.MTParseT
filename := util.InputTerminal("Введите имя файла базы данных сохранненой с сайта для парсинга (json)")
bs, err := os.ReadFile(filename + ".json")
util.Check(err, "")
err = json.Unmarshal(bs, &inTest)
util.Check(err, "")
for _, in := range inTest {
outTest = append(outTest, in.Parse())
}
model.SaveToExel(filename+".xlsx", &outTest)
outTestJSON, err := json.Marshal(outTest)
util.Check(err, "")
err = os.WriteFile(filename+"_parse.json", outTestJSON, 0644)
util.Check(err, "")
}