fix bug in InsertIPBulk
This commit is contained in:
parent
b1b7302c7a
commit
1ef4b1789a
@ -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) {
|
func InsertIPBulk(cfg *config.Config, ips *[]IP) (numinserts int64, numupdates int64, numfail int64, err error) {
|
||||||
var iplist []string
|
var iplist []string
|
||||||
hostname := (*ips)[0].Hostname
|
hostname := (*ips)[0].Hostname.String
|
||||||
for _, ip := range *ips {
|
for _, ip := range *ips {
|
||||||
iplist = append(iplist, ip.IP)
|
iplist = append(iplist, ip.IP)
|
||||||
}
|
}
|
||||||
@ -154,3 +154,8 @@ type APIIP struct {
|
|||||||
Src string `json:"src"`
|
Src string `json:"src"`
|
||||||
Hostname string `json:"hostname"`
|
Hostname string `json:"hostname"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Src struct {
|
||||||
|
ID int `xorm:"pk autoincr" json:"-"`
|
||||||
|
Src string `xorm:"text notnull unique" json:"src"`
|
||||||
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Src struct {
|
|
||||||
ID int `xorm:"pk autoincr" json:"-"`
|
|
||||||
Src string `xorm:"text notnull unique" json:"src"`
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user