MCPcopy Create free account
hub / github.com/buggregator/server / handleClearAll

Function handleClearAll

modules/sentry/api.go:22–42  ·  view source on GitHub ↗

handleClearAll deletes all data from sentry structured tables.

(db *sql.DB)

Source from the content-addressed store, hash-verified

20
21// handleClearAll deletes all data from sentry structured tables.
22func 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.
45func pagination(r *http.Request, defaultLimit int) (limit, offset int) {

Callers 1

registerAPIFunction · 0.85

Calls 2

apiErrorFunction · 0.85
apiJSONFunction · 0.85

Tested by

no test coverage detected