MCPcopy Create free account
hub / github.com/fnproject/fn / RemoveApp

Method RemoveApp

api/datastore/sql/sql.go:402–429  ·  view source on GitHub ↗
(ctx context.Context, appID string)

Source from the content-addressed store, hash-verified

400}
401
402func (ds *SQLStore) RemoveApp(ctx context.Context, appID string) error {
403 return ds.Tx(func(tx *sqlx.Tx) error {
404 res, err := tx.ExecContext(ctx, tx.Rebind(`DELETE FROM apps WHERE id=?`), appID)
405 if err != nil {
406 return err
407 }
408 n, err := res.RowsAffected()
409 if err != nil {
410 return err
411 }
412 if n == 0 {
413 return models.ErrAppsNotFound
414 }
415
416 deletes := []string{
417 `DELETE FROM fns WHERE app_id=?`,
418 `DELETE FROM triggers WHERE app_id=?`,
419 }
420 for _, stmt := range deletes {
421 _, err := tx.ExecContext(ctx, tx.Rebind(stmt), appID)
422 if err != nil {
423 return err
424 }
425 }
426
427 return nil
428 })
429}
430
431func (ds *SQLStore) GetAppByID(ctx context.Context, appID string) (*models.App, error) {
432 var app models.App

Callers

nothing calls this directly

Calls 1

TxMethod · 0.95

Tested by

no test coverage detected