// GetVersionsList retrieves a list of version records from the DB that match a given train & component
GetVersionsList retrieves a list of version records from the DB that match a given train & component
// GetVersionsList retrieves a list of version records from the DB that match a given train & component
func GetVersionsList(db *gorm.DB, train string, component string) ([]*models.ComponentVersion, error) {
	var rowsResult []versionsTable
	resDB := db.Where(&versionsTable{Train: train, ComponentName: component}).Find(&rowsResult)
	if resDB.Error != nil {
		return nil, resDB.Error
	}
	componentVersions, err := parseDBVersions(rowsResult)
	if err != nil {
		log.Println("error parsing DB versions data")
		return nil, err
	}
	return componentVersions, nil
}
func GetVersionsList ( db * gorm . DB , train string , component string ) ( [ ] * models . ComponentVersion , error ) { var rowsResult [ ] versionsTable resDB := db . Where ( & versionsTable { Train : train , ComponentName : component } ) . Find ( & rowsResult ) if resDB . Error != nil { return nil , resDB . Error } componentVersions , err := parseDBVersions ( rowsResult ) if err != nil { log . Println ( " " ) return nil , err } return componentVersions , nil }
GetVersionsList retrieves a list of version records from the DB that match a given train & component
GetVersionsList retrieves a list of version records from the DB that match a given train & component