func (r *GormWorkItemLinkTypeRepository) Save(ctx context.Context, modelToSave WorkItemLinkType) (*WorkItemLinkType, error) {
	existingModel := WorkItemLinkType{}
	db := r.db.Model(&existingModel).Where("id=?", modelToSave.ID).First(&existingModel)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": modelToSave.ID,
		}, "work item link type not found")
		return nil, errors.NewNotFoundError("work item link type", modelToSave.ID.String())
	}
	if db.Error != nil {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": modelToSave.ID,
			"err":     db.Error,
		}, "unable to find work item link type repository")
		return nil, errors.NewInternalError(db.Error.Error())
	}
	if existingModel.Version != modelToSave.Version {
		return nil, errors.NewVersionConflictError("version conflict")
	}
	modelToSave.Version = modelToSave.Version + 1
	db = db.Save(&modelToSave)
	if db.Error != nil {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": existingModel.ID,
			"wilt":    existingModel,
			"err":     db.Error,
		}, "unable to save work item link type repository")
		return nil, errors.NewInternalError(db.Error.Error())
	}
	log.Info(ctx, map[string]interface{}{
		"wilt_id": existingModel.ID,
		"wilt":    existingModel,
	}, "Work item link type updated %v", modelToSave)
	return &modelToSave, nil
}
// Save updates the given work item link type in storage. Version must be the same as the one int the stored version.
// returns NotFoundError, VersionConflictError, ConversionError or InternalError
Save updates the given work item link type in storage. Version must be the same as the one int the stored version.
returns NotFoundError, VersionConflictError, ConversionError or InternalError
// Save updates the given work item link type in storage . Version must be the same as the one int the stored version . // returns NotFoundError VersionConflictError ConversionError or InternalError
func (r *GormWorkItemLinkTypeRepository) Save(ctx context.Context, modelToSave WorkItemLinkType) (*WorkItemLinkType, error) {
	existingModel := WorkItemLinkType{}
	db := r.db.Model(&existingModel).Where("id=?", modelToSave.ID).First(&existingModel)
	if db.RecordNotFound() {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": modelToSave.ID,
		}, "work item link type not found")
		return nil, errors.NewNotFoundError("work item link type", modelToSave.ID.String())
	}
	if db.Error != nil {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": modelToSave.ID,
			"err":     db.Error,
		}, "unable to find work item link type repository")
		return nil, errors.NewInternalError(db.Error.Error())
	}
	if existingModel.Version != modelToSave.Version {
		return nil, errors.NewVersionConflictError("version conflict")
	}
	modelToSave.Version = modelToSave.Version + 1
	db = db.Save(&modelToSave)
	if db.Error != nil {
		log.Error(ctx, map[string]interface{}{
			"wilt_id": existingModel.ID,
			"wilt":    existingModel,
			"err":     db.Error,
		}, "unable to save work item link type repository")
		return nil, errors.NewInternalError(db.Error.Error())
	}
	log.Info(ctx, map[string]interface{}{
		"wilt_id": existingModel.ID,
		"wilt":    existingModel,
	}, "Work item link type updated %v", modelToSave)
	return &modelToSave, nil
}
func ( r * GormWorkItemLinkTypeRepository ) Save ( ctx context . Context , modelToSave WorkItemLinkType ) ( * WorkItemLinkType , error ) { existingModel := WorkItemLinkType { } db := r . db . Model ( & existingModel ) . Where ( " " , modelToSave . ID ) . First ( & existingModel ) if db . RecordNotFound ( ) { log . Error ( ctx , map [ string ] interface { } { " " : modelToSave . ID , } , " " ) return nil , errors . NewNotFoundError ( " " , modelToSave . ID . String ( ) ) } if db . Error != nil { log . Error ( ctx , map [ string ] interface { } { " " : modelToSave . ID , " " : db . Error , } , " " ) return nil , errors . NewInternalError ( db . Error . Error ( ) ) } if existingModel . Version != modelToSave . Version { return nil , errors . NewVersionConflictError ( " " ) } modelToSave . Version = modelToSave . Version + 1 db = db . Save ( & modelToSave ) if db . Error != nil { log . Error ( ctx , map [ string ] interface { } { " " : existingModel . ID , " " : existingModel , " " : db . Error , } , " " ) return nil , errors . NewInternalError ( db . Error . Error ( ) ) } log . Info ( ctx , map [ string ] interface { } { " " : existingModel . ID , " " : existingModel , } , " " , modelToSave ) return & modelToSave , nil }
Save updates the given work item link type in storage.
Save updates the given work item link type in storage .