// UpdateStatusCondition sets the condition to a status.
// for example Ready condition to True, or False
UpdateStatusCondition sets the condition to a status.
for example Ready condition to True, or False
// UpdateStatusCondition sets the condition to a status . // for example Ready condition to True or False
func (u *MySQLUser) UpdateStatusCondition(
	condType mysqlv1alpha1.MysqlUserConditionType,
	status v1.ConditionStatus, reason, message string,
) (
	cond *mysqlv1alpha1.MySQLUserCondition, changed bool,
) {
	t := metav1.NewTime(time.Now())
	existingCondition, exists := u.ConditionExists(condType)
	if !exists {
		newCondition := mysqlv1alpha1.MySQLUserCondition{
			Type:               condType,
			Status:             status,
			Reason:             reason,
			Message:            message,
			LastTransitionTime: t,
			LastUpdateTime:     t,
		}
		u.Status.Conditions = append(u.Status.Conditions, newCondition)
		return &newCondition, true
	}
	if status != existingCondition.Status {
		existingCondition.LastTransitionTime = t
		changed = true
	}
	if message != existingCondition.Message || reason != existingCondition.Reason {
		existingCondition.LastUpdateTime = t
		changed = true
	}
	existingCondition.Status = status
	existingCondition.Message = message
	existingCondition.Reason = reason
	return existingCondition, changed
}
func ( u * MySQLUser ) UpdateStatusCondition ( condType mysqlv1alpha1 . MysqlUserConditionType , status v1 . ConditionStatus , reason , message string , ) ( cond * mysqlv1alpha1 . MySQLUserCondition , changed bool , ) { t := metav1 . NewTime ( time . Now ( ) ) existingCondition , exists := u . ConditionExists ( condType ) if ! exists { newCondition := mysqlv1alpha1 . MySQLUserCondition { Type : condType , Status : status , Reason : reason , Message : message , LastTransitionTime : t , LastUpdateTime : t , } u . Status . Conditions = append ( u . Status . Conditions , newCondition ) return & newCondition , true } if status != existingCondition . Status { existingCondition . LastTransitionTime = t changed = true } if message != existingCondition . Message || reason != existingCondition . Reason { existingCondition . LastUpdateTime = t changed = true } existingCondition . Status = status existingCondition . Message = message existingCondition . Reason = reason return existingCondition , changed }
UpdateStatusCondition sets the condition to a status.
UpdateStatusCondition sets the condition to a status .