MCPcopy Create free account
hub / github.com/cloudbase/garm / getScaleSetByID

Method getScaleSetByID

database/sql/util.go:715–733  ·  view source on GitHub ↗
(tx *gorm.DB, scaleSetID uint, preload ...string)

Source from the content-addressed store, hash-verified

713}
714
715func (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
735func (s *sqlDatabase) hasGithubEntity(tx *gorm.DB, entityType params.ForgeEntityType, entityID string) error {
736 u, err := uuid.Parse(entityID)

Callers 5

GetScaleSetByIDMethod · 0.95
DeleteScaleSetByIDMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected