package models

type RaspDevList struct {
	Id int64 `json:"id"`
	Addr string `json:"addr"`
	PaiVersion string `json:"pai_version"`
	UpdateTime int64 `json:"update_time"`
	Height int64 `json:"height"`
	BtyVersion string `json:"bty_version"`
	ExtIp string `json:"ext_ip"`
	Error string `json:"error"`
	WalletStatus int32 `json:"wallet_status"`
	NodeStatus int32 `json:"node_status"`
	PaiStatus int32 `json:"pai_status"`
	UserName string `json:"user_name"`
	Email string `json:"email"`
	Phone string `json:"phone"`
}

func UpdateDevList(rasp RaspDevList) error {
	var dev RaspDevList
	err := db.Where(RaspDevList{Addr: rasp.Addr}).Assign(rasp).FirstOrCreate(&dev).Error
	if err != nil  {
		return err
	}
	return nil
}
