// GetVersion gets a single version record from a DB matching the unique property values in a ComponentVersion struct
GetVersion gets a single version record from a DB matching the unique property values in a ComponentVersion struct
// GetVersion gets a single version record from a DB matching the unique property values in a ComponentVersion struct
func GetVersion(db *gorm.DB, cV models.ComponentVersion) (models.ComponentVersion, error) {
	resTable := new(versionsTable)
	resDB := db.Where(versionsTable{
		ComponentName: cV.Component.Name,
		Train:         cV.Version.Train,
		Version:       cV.Version.Version,
	}).First(resTable)
	if resDB.Error != nil {
		return models.ComponentVersion{}, resDB.Error
	}
	componentVersion, err := parseDBVersion(*resTable)
	if err != nil {
		return models.ComponentVersion{}, err
	}
	return componentVersion, nil
}
func GetVersion ( db * gorm . DB , cV models . ComponentVersion ) ( models . ComponentVersion , error ) { resTable := new ( versionsTable ) resDB := db . Where ( versionsTable { ComponentName : cV . Component . Name , Train : cV . Version . Train , Version : cV . Version . Version , } ) . First ( resTable ) if resDB . Error != nil { return models . ComponentVersion { } , resDB . Error } componentVersion , err := parseDBVersion ( * resTable ) if err != nil { return models . ComponentVersion { } , err } return componentVersion , nil }
GetVersion gets a single version record from a DB matching the unique property values in a ComponentVersion struct
GetVersion gets a single version record from a DB matching the unique property values in a ComponentVersion struct