(tx *gorm.DB, scaleSetID uint, preload ...string)
| 713 | } |
| 714 | |
| 715 | func (s *sqlDatabase) getScaleSetByID(tx *gorm.DB, scaleSetID uint, preload ...string) (ScaleSet, error) { |
| 716 | var scaleSet ScaleSet |
| 717 | q := tx.Model(&ScaleSet{}) |
| 718 | if len(preload) > 0 { |
| 719 | for _, item := range preload { |
| 720 | q = q.Preload(item) |
| 721 | } |
| 722 | } |
| 723 | |
| 724 | q = q.Where("id = ?", scaleSetID).First(&scaleSet) |
| 725 | |
| 726 | if q.Error != nil { |
| 727 | if errors.Is(q.Error, gorm.ErrRecordNotFound) { |
| 728 | return ScaleSet{}, runnerErrors.ErrNotFound |
| 729 | } |
| 730 | return ScaleSet{}, fmt.Errorf("error fetching scale set from database: %w", q.Error) |
| 731 | } |
| 732 | return scaleSet, nil |
| 733 | } |
| 734 | |
| 735 | func (s *sqlDatabase) hasGithubEntity(tx *gorm.DB, entityType params.ForgeEntityType, entityID string) error { |
| 736 | u, err := uuid.Parse(entityID) |
no outgoing calls
no test coverage detected