34 lines
782 B
Go
34 lines
782 B
Go
package main
|
||
|
||
import (
|
||
"encoding/json"
|
||
"io/ioutil"
|
||
"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 := ioutil.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, "")
|
||
}
|