handleClearAll deletes all data from sentry structured tables.
(db *sql.DB)
| 20 | |
| 21 | // handleClearAll deletes all data from sentry structured tables. |
| 22 | func handleClearAll(db *sql.DB) http.HandlerFunc { |
| 23 | return func(w http.ResponseWriter, r *http.Request) { |
| 24 | // Order matters: child tables first (FK cascades handle some, but be explicit). |
| 25 | tables := []string{ |
| 26 | "sentry_breadcrumbs", |
| 27 | "sentry_exceptions", |
| 28 | "sentry_error_events", |
| 29 | "sentry_spans", |
| 30 | "sentry_transactions", |
| 31 | "sentry_traces", |
| 32 | "sentry_logs", |
| 33 | } |
| 34 | for _, t := range tables { |
| 35 | if _, err := db.Exec("DELETE FROM " + t); err != nil { |
| 36 | apiError(w, err.Error(), http.StatusInternalServerError) |
| 37 | return |
| 38 | } |
| 39 | } |
| 40 | apiJSON(w, map[string]any{"status": true}) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // pagination extracts page/limit from query params with defaults. |
| 45 | func pagination(r *http.Request, defaultLimit int) (limit, offset int) { |
no test coverage detected