mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
Include date_entered
when inporting from old API
When importing from old API endpoint, also get the `date_entered` field and insert to database.
This commit is contained in:
parent
df8b933374
commit
bd37f17072
1 changed files with 7 additions and 6 deletions
|
@ -18,10 +18,11 @@ func newImport(db *database.DB) *importClient {
|
|||
}
|
||||
|
||||
type importData struct {
|
||||
Hostname string `json:"hostname"`
|
||||
Port int `json:"port"`
|
||||
Protocol string `json:"protocol"`
|
||||
IsTor bool `json:"is_tor"`
|
||||
Hostname string `json:"hostname"`
|
||||
Port int `json:"port"`
|
||||
Protocol string `json:"protocol"`
|
||||
IsTor bool `json:"is_tor"`
|
||||
DateEntered int `json:"date_entered"`
|
||||
}
|
||||
|
||||
var importCmd = &cobra.Command{
|
||||
|
@ -84,8 +85,8 @@ func (i *importClient) processData(node importData) error {
|
|||
}
|
||||
|
||||
// insert
|
||||
query = `INSERT INTO tbl_node (hostname, port, protocol, is_tor, nettype, ip_addr, last_check_status) VALUES (?, ?, ?, ?, ?, ?, ?)`
|
||||
_, err = i.db.Exec(query, node.Hostname, node.Port, node.Protocol, node.IsTor, "", "", "[2,2,2,2,2]")
|
||||
query = `INSERT INTO tbl_node (hostname, port, protocol, is_tor, nettype, ip_addr, date_entered, last_check_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||
_, err = i.db.Exec(query, node.Hostname, node.Port, node.Protocol, node.IsTor, "", "", node.DateEntered, "[2,2,2,2,2]")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue