fix bug in InsertIPBulk

This commit is contained in:
Paul 2022-03-19 16:21:08 +01:00
parent b1b7302c7a
commit 1ef4b1789a
2 changed files with 6 additions and 7 deletions

View File

@ -62,7 +62,7 @@ func (i *IP) InsertIP(cfg *config.Config) (num int64, err error) {
func InsertIPBulk(cfg *config.Config, ips *[]IP) (numinserts int64, numupdates int64, numfail int64, err error) {
var iplist []string
hostname := (*ips)[0].Hostname
hostname := (*ips)[0].Hostname.String
for _, ip := range *ips {
iplist = append(iplist, ip.IP)
}
@ -154,3 +154,8 @@ type APIIP struct {
Src string `json:"src"`
Hostname string `json:"hostname"`
}
type Src struct {
ID int `xorm:"pk autoincr" json:"-"`
Src string `xorm:"text notnull unique" json:"src"`
}

View File

@ -1,6 +0,0 @@
package models
type Src struct {
ID int `xorm:"pk autoincr" json:"-"`
Src string `xorm:"text notnull unique" json:"src"`
}