mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Simplifying app delete per review comments
This commit is contained in:
@@ -118,23 +118,5 @@ func (m *metricds) DeleteLog(ctx context.Context, appName, callID string) error
|
||||
return m.ds.DeleteLog(ctx, appName, callID)
|
||||
}
|
||||
|
||||
func (m *metricds) BatchDeleteLogs(ctx context.Context, appName string) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "ds_batch_delete_logs")
|
||||
defer span.Finish()
|
||||
return m.ds.BatchDeleteLogs(ctx, appName)
|
||||
}
|
||||
|
||||
func (m *metricds) BatchDeleteCalls(ctx context.Context, appName string) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "ds_batch_delete_calls")
|
||||
defer span.Finish()
|
||||
return m.ds.BatchDeleteCalls(ctx, appName)
|
||||
}
|
||||
|
||||
func (m *metricds) BatchDeleteRoutes(ctx context.Context, appName string) error {
|
||||
span, ctx := opentracing.StartSpanFromContext(ctx, "ds_batch_delete_routes")
|
||||
defer span.Finish()
|
||||
return m.ds.BatchDeleteRoutes(ctx, appName)
|
||||
}
|
||||
|
||||
// instant & no context ;)
|
||||
func (m *metricds) GetDatabase() *sqlx.DB { return m.ds.GetDatabase() }
|
||||
|
||||
@@ -142,18 +142,6 @@ func (v *validator) DeleteLog(ctx context.Context, appName, callID string) error
|
||||
return v.Datastore.DeleteLog(ctx, appName, callID)
|
||||
}
|
||||
|
||||
func (v *validator) BatchDeleteLogs(ctx context.Context, appName string) error {
|
||||
return v.Datastore.BatchDeleteLogs(ctx, appName)
|
||||
}
|
||||
|
||||
func (v *validator) BatchDeleteCalls(ctx context.Context, appName string) error {
|
||||
return v.Datastore.BatchDeleteCalls(ctx, appName)
|
||||
}
|
||||
|
||||
func (v *validator) BatchDeleteRoutes(ctx context.Context, appName string) error {
|
||||
return v.Datastore.BatchDeleteRoutes(ctx, appName)
|
||||
}
|
||||
|
||||
// GetDatabase returns the underlying sqlx database implementation
|
||||
func (v *validator) GetDatabase() *sqlx.DB {
|
||||
return v.Datastore.GetDatabase()
|
||||
|
||||
@@ -221,6 +221,8 @@ func (ds *sqlStore) UpdateApp(ctx context.Context, newapp *models.App) (*models.
|
||||
}
|
||||
|
||||
func (ds *sqlStore) RemoveApp(ctx context.Context, appName string) error {
|
||||
ds.db.ExecContext(ctx, ds.db.Rebind(
|
||||
`DELETE FROM routes, calls, logs WHERE app_name=?`), appName)
|
||||
query := ds.db.Rebind(`DELETE FROM apps WHERE name = ?`)
|
||||
_, err := ds.db.ExecContext(ctx, query, appName)
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user