Создана конвертация

This commit is contained in:
Anatoly Prohacky 2023-04-15 00:51:35 +10:00
parent 666a1a3c12
commit e6a62b4f2b
13 changed files with 492 additions and 35007 deletions

17417
data.json

File diff suppressed because it is too large Load Diff

10454
data1.json

File diff suppressed because it is too large Load Diff

6965
data2.json

File diff suppressed because it is too large Load Diff

13
go.mod
View File

@ -1,3 +1,16 @@
module gitstore.ru/tolikproh/sirius module gitstore.ru/tolikproh/sirius
go 1.20 go 1.20
require github.com/xuri/excelize/v2 v2.7.1
require (
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/richardlehane/mscfb v1.0.4 // indirect
github.com/richardlehane/msoleps v1.0.3 // indirect
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/text v0.9.0 // indirect
)

62
go.sum Normal file
View File

@ -0,0 +1,62 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/richardlehane/mscfb v1.0.4 h1:WULscsljNPConisD5hR0+OyZjwK46Pfyr6mPu5ZawpM=
github.com/richardlehane/mscfb v1.0.4/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/richardlehane/msoleps v1.0.3 h1:aznSZzrwYRl3rLKRT3gUk9am7T/mLNSnJINvN0AQoVM=
github.com/richardlehane/msoleps v1.0.3/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 h1:6932x8ltq1w4utjmfMPVj09jdMlkY0aiA6+Skbtl3/c=
github.com/xuri/efp v0.0.0-20220603152613-6918739fd470/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
github.com/xuri/excelize/v2 v2.7.1 h1:gm8q0UCAyaTt3MEF5wWMjVdmthm2EHAWesGSKS9tdVI=
github.com/xuri/excelize/v2 v2.7.1/go.mod h1:qc0+2j4TvAUrBw36ATtcTeC1VCM0fFdAXZOmcF4nTpY=
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 h1:OAmKAfT06//esDdpi/DZ8Qsdt4+M5+ltca05dA5bG2M=
github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
golang.org/x/image v0.5.0/go.mod h1:FVC7BI/5Ym8R25iw5OLsgshdUBbT1h5jZTpA+mvAdZ4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

BIN
main Executable file

Binary file not shown.

BIN
main.exe

Binary file not shown.

55
main.go
View File

@ -1,29 +1,68 @@
package main package main
import ( import (
"bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os"
"strconv"
excelize "github.com/xuri/excelize/v2"
"gitstore.ru/tolikproh/sirius/model" "gitstore.ru/tolikproh/sirius/model"
) )
func main() { func main() {
var sirius model.Sirius var sirius model.Sirius
siriusJson, err := ioutil.ReadFile("data1.json") siriusJson, err := ioutil.ReadFile("sirius.json")
if err != nil { if err != nil {
fmt.Println("No read file") fmt.Println("No read file: sirius.json")
panic(err) os.Exit(0)
} }
fmt.Println(json.Valid(siriusJson)) siriusJson = bytes.TrimPrefix(siriusJson, []byte("\xef\xbb\xbf"))
if !json.Valid(siriusJson) {
fmt.Println("Formated file not supported: sirius.json")
os.Exit(0)
}
fmt.Println("Start converted ....")
err = json.Unmarshal(siriusJson, &sirius) err = json.Unmarshal(siriusJson, &sirius)
if err != nil { if err != nil {
fmt.Println("Error unmarshal") fmt.Println("Error unmarshal file: sirius.json")
panic(err) os.Exit(0)
} }
sirius.Zone.Get() if err := SaveToExel("sirius.xlsx", sirius.NewBolid().ZoneInfo()); err != nil {
fmt.Println(sirius.Zone.Get()) fmt.Println("Error create file: sirius.xlsx")
os.Exit(0)
}
fmt.Println("Converted finalise. Create file: sirius.xlsx")
}
func SaveToExel(filename string, data []model.ZoneInfo) error {
f := excelize.NewFile()
defer func() {
if err := f.Close(); err != nil {
return
}
}()
// Create a new sheet.
f.SetCellValue("Sheet1", "A2", "№ зоны")
f.SetCellValue("Sheet1", "B2", "Описание зоны")
f.SetCellValue("Sheet1", "C2", "Адреса в зоне")
i := 3
for _, d := range data {
f.SetCellValue("Sheet1", "A"+strconv.Itoa(i), d.ZoneNum)
f.SetCellValue("Sheet1", "B"+strconv.Itoa(i), d.ZoneName)
f.SetCellValue("Sheet1", "C"+strconv.Itoa(i), d.InputString())
i++
}
// Save spreadsheet by the given path.
if err := f.SaveAs(filename); err != nil {
return err
}
return nil
} }

View File

@ -1,184 +1,131 @@
package model package model
// Sirius structure import "fmt"
type Sirius struct {
Device `json:"device"` type Bolid struct {
Zone `json:"zone"` Devices []DevBolid
ZoneGroup `json:"zone_group"` Zones []ZoneBolid
Input `json:"input"`
Output `json:"output"`
Reader `json:"reader"`
Channel `json:"channel"`
AccessGroup `json:"access_group"`
} }
// Device type DevBolid struct {
type Device struct { Name string
Keys []string `json:"keys"` Type int64
Rows []interface{} `json:"rows"` Addr int64
Input []InputBolid
} }
// type DeviceRows struct { type InputBolid struct {
// I1 int64 ZoneId int64
// I2 int64
// B1 bool
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// I7 int64
// I8 int64
// I9 int64
// IntArr1 []int64
// IntArr2 []int64
// Name string
// }
// Zone
type Zone struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Zone) Get() []ZoneRows {
var zr []ZoneRows
for _, z := range z.Rows {
i, b, s := InterToArray(z)
zz := ZoneRows{
Number: i[0],
I1: i[1],
B1: b[0],
I2: i[2],
I3: i[3],
I4: i[4],
B2: b[1],
B3: b[2],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
type ZoneRows struct {
Number int64
I1 int64
B1 bool
I2 int64
I3 int64
I4 int64
B2 bool
B3 bool
Name string Name string
Addr int64
} }
// ZoneGroup type ZoneBolid struct {
type ZoneGroup struct { ZoneId int64
Keys []string `json:"keys"` Name string
Rows []interface{} `json:"rows"` Number int64
} }
// type ZoneGroupRows struct { type ZoneInfo struct {
// Number int64 ZoneNum int64
// I2 int64 ZoneName string
// B1 bool Input []InputInfo
// I3 int64
// I4 int64
// IntArr []int64
// Name string
// }
// Input
type Input struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
} }
// type InputRows struct { type InputInfo struct {
// Addr int64 DevAdd int64
// I2 int64 Address int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// I7 int64
// I8 int64
// Name string
// }
// Output
type Output struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
} }
// type OutputRows struct { func (z *ZoneInfo) InputString() string {
// Addr int64 var zones string
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// I7 int64
// I8 int64
// I9 int64
// I10 int64
// I11 int64
// IntArr1 []int64
// IntArr2 []int64
// I12 int64
// I13 int64
// Name string
// }
// Reader i := 0
type Reader struct { for _, inp := range z.Input {
Keys []string `json:"keys"` if i != 0 {
Rows []interface{} `json:"rows"` zones = zones + ", "
}
zones = zones + fmt.Sprint(inp.DevAdd) + "." + fmt.Sprint(inp.Address)
i++
}
return zones
} }
// type ReaderRows struct { func (b *Bolid) ZoneInfo() []ZoneInfo {
// I1 int64 var zonesInfo []ZoneInfo
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// IntArr1 []int64
// IntArr2 []int64
// Name string
// }
// Channel for _, zon := range b.Zones {
type Channel struct { var zi ZoneInfo
Keys []string `json:"keys"` for _, dev := range b.Devices {
Rows []interface{} `json:"rows"` var i InputInfo
for _, inp := range dev.Input {
if zon.ZoneId == inp.ZoneId {
zi.ZoneNum = zon.Number
zi.ZoneName = zon.Name
i.DevAdd = dev.Addr
i.Address = inp.Addr
zi.Input = append(zi.Input, i)
}
}
}
zonesInfo = append(zonesInfo, zi)
}
return zonesInfo
} }
// type ChannelRows struct { func (s *Sirius) NewBolid() *Bolid {
// I1 int64 return &Bolid{
// I2 int64 Devices: s.NewDevices(),
// I3 int64 Zones: s.NewZones(),
// I4 int64 }
// I5 int64
// Name string
// }
// AccessGroup
type AccessGroup struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
} }
// type AccessGroupRows struct { func (s *Sirius) NewDevices() []DevBolid {
// I1 int64 var devices []DevBolid
// I2 int64
// IntArr1 []AccessGroupIntArray
// Name string
// }
// type AccessGroupIntArray struct { for _, dev := range s.Device.Get() {
// I1 int64 d := DevBolid{
// I2 int64 Name: dev.Name,
// } Type: dev.Type,
Addr: dev.Addr,
Input: s.GetInput(dev.DevID),
}
devices = append(devices, d)
}
return devices
}
func (s *Sirius) GetInput(devId int64) []InputBolid {
var inputs []InputBolid
for _, inp := range s.Input.Get() {
if devId == inp.DevID {
i := InputBolid{
ZoneId: inp.ZoneID,
Name: inp.Name,
Addr: inp.AddrU,
}
inputs = append(inputs, i)
}
}
return inputs
}
func (s *Sirius) NewZones() []ZoneBolid {
var zones []ZoneBolid
for _, zon := range s.Zone.Get() {
z := ZoneBolid{
ZoneId: zon.ZoneID,
Name: zon.Name,
Number: zon.Number,
}
zones = append(zones, z)
}
return zones
}

257
model/sirius.go Normal file
View File

@ -0,0 +1,257 @@
package model
// Sirius structure
type Sirius struct {
Device `json:"device"`
Zone `json:"zone"`
ZoneGroup `json:"zone_group"`
Input `json:"input"`
Output `json:"output"`
Reader `json:"reader"`
Channel `json:"channel"`
AccessGroup `json:"access_group"`
User `json:"user"`
Script `json:"script"`
Program `json:"program"`
Controller `json:"controller"`
}
// Device
type Device struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Device) Get() []DeviceRows {
var zr []DeviceRows
for _, z := range z.Rows {
i, b, s, _ := InterToArray(z)
zz := DeviceRows{
DevID: i[0],
I2: i[1],
B1: b[0],
Addr: i[2],
I4: i[3],
Type: i[4],
I6: i[5],
I7: i[6],
I8: i[7],
I9: i[8],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
// Type-40(КДЛС-С) Type-81(КДЛ-2И)
type DeviceRows struct {
DevID int64
I2 int64
B1 bool
Addr int64
I4 int64
Type int64
I6 int64
I7 int64
I8 int64
I9 int64
IntArr1 []int64
IntArr2 []int64
Name string
}
// Zone
type Zone struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Zone) Get() []ZoneRows {
var zr []ZoneRows
for _, z := range z.Rows {
i, b, s, _ := InterToArray(z)
zz := ZoneRows{
ZoneID: i[0],
I1: i[1],
B1: b[0],
Number: i[2],
I3: i[3],
I4: i[4],
B2: b[1],
B3: b[2],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
type ZoneRows struct {
ZoneID int64
I1 int64
B1 bool
Number int64
I3 int64
I4 int64
B2 bool
B3 bool
Name string
}
// ZoneGroup
type ZoneGroup struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type ZoneGroupRows struct {
// Number int64
// I2 int64
// B1 bool
// I3 int64
// I4 int64
// IntArr []int64
// Name string
// }
// Input
type Input struct {
Keys []string `json:"keys"`
Rows [][]interface{} `json:"rows"`
}
func (z *Input) Get() []InputRows {
var zr []InputRows
for _, z := range z.Rows {
i, _, s, _ := InterToArray(z)
zz := InputRows{
InputID: i[0],
DevID: i[1],
AddrU: i[2],
I4: i[3],
I5: i[4],
I6: i[5],
ZoneID: i[6],
I8: i[7],
Name: s[0],
}
zr = append(zr, zz)
}
return zr
}
type InputRows struct {
InputID int64
DevID int64
AddrU int64
I4 int64
I5 int64
I6 int64
ZoneID int64
I8 int64
Name string
}
// Output
type Output struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type OutputRows struct {
// Addr int64
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// I7 int64
// I8 int64
// I9 int64
// I10 int64
// I11 int64
// IntArr1 []int64
// IntArr2 []int64
// I12 int64
// I13 int64
// Name string
// }
// Reader
type Reader struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type ReaderRows struct {
// I1 int64
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// I6 int64
// IntArr1 []int64
// IntArr2 []int64
// Name string
// }
// Channel
type Channel struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type ChannelRows struct {
// I1 int64
// I2 int64
// I3 int64
// I4 int64
// I5 int64
// Name string
// }
// AccessGroup
type AccessGroup struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// type AccessGroupRows struct {
// I1 int64
// I2 int64
// IntArr1 []AccessGroupIntArray
// Name string
// }
// type AccessGroupIntArray struct {
// I1 int64
// I2 int64
// }
// User
type User struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// Script
type Script struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// Program
type Program struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}
// Controller
type Controller struct {
Keys []string `json:"keys"`
Rows []interface{} `json:"rows"`
}

View File

@ -1,9 +1,10 @@
package model package model
func InterToArray(inp []interface{}) ([]int64, []bool, []string) { func InterToArray(inp []interface{}) ([]int64, []bool, []string, []interface{}) {
var i []int64 var i []int64
var b []bool var b []bool
var s []string var s []string
var a []interface{}
for _, v1 := range inp { for _, v1 := range inp {
switch v2 := v1.(type) { switch v2 := v1.(type) {
case float64: case float64:
@ -12,8 +13,10 @@ func InterToArray(inp []interface{}) ([]int64, []bool, []string) {
b = append(b, bool(v2)) b = append(b, bool(v2))
case string: case string:
s = append(s, string(v2)) s = append(s, string(v2))
default:
a = append(a, v2)
} }
} }
return i, b, s return i, b, s, a
} }

File diff suppressed because one or more lines are too long

BIN
sirius.xlsx Executable file

Binary file not shown.