package models

type RaspVersion struct {
	//Model
	Id   int64 `json:"id" gorm:"PRIMARY_KEY"`
	Version   string `json:"version"`
	Type int32 `json:"type"`
	Addtime int64 `json:"addtime"`
}

// GetHeight get lastheight in chain33
func GetLatestVersion(t int32) (string, error) {
	var rasp RaspVersion
	err := db.Model(&RaspVersion{}).Where("type = ?",t).Order("id desc").First(&rasp).Error
	if err != nil  {
		return "",err
	}
	return rasp.Version, nil
}

