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

Method DeletePoolByID

database/sql/pools.go:84–101  ·  view source on GitHub ↗
(_ context.Context, poolID string)

Source from the content-addressed store, hash-verified

82}
83
84func (s *sqlDatabase) DeletePoolByID(_ context.Context, poolID string) (err error) {
85 pool, err := s.getPoolByID(s.conn, poolID)
86 if err != nil {
87 return fmt.Errorf("error fetching pool by ID: %w", err)
88 }
89
90 defer func() {
91 if err == nil {
92 s.sendNotify(common.PoolEntityType, common.DeleteOperation, params.Pool{ID: poolID})
93 }
94 }()
95
96 if q := s.conn.Unscoped().Delete(&pool); q.Error != nil {
97 return fmt.Errorf("error removing pool: %w", q.Error)
98 }
99
100 return nil
101}
102
103func (s *sqlDatabase) getEntityPool(tx *gorm.DB, entityType params.ForgeEntityType, entityID, poolID string, preload ...string) (Pool, error) {
104 if entityID == "" {

Callers

nothing calls this directly

Calls 3

getPoolByIDMethod · 0.95
sendNotifyMethod · 0.95
DeleteMethod · 0.65

Tested by

no test coverage detected