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

Method DeleteAll

internal/storage/sqlite.go:100–131  ·  view source on GitHub ↗
(ctx context.Context, opts event.DeleteOptions)

Source from the content-addressed store, hash-verified

98}
99
100func (s *SQLiteStore) DeleteAll(ctx context.Context, opts event.DeleteOptions) error {
101 if len(opts.UUIDs) > 0 {
102 placeholders := make([]string, len(opts.UUIDs))
103 args := make([]any, len(opts.UUIDs))
104 for i, u := range opts.UUIDs {
105 placeholders[i] = "?"
106 args[i] = u
107 }
108 _, err := s.db.ExecContext(ctx,
109 `DELETE FROM events WHERE uuid IN (`+strings.Join(placeholders, ",")+`)`, args...)
110 return err
111 }
112
113 query := `DELETE FROM events`
114 var args []any
115 var conditions []string
116
117 if opts.Type != "" {
118 conditions = append(conditions, "type = ?")
119 args = append(args, opts.Type)
120 }
121 if opts.Project != "" {
122 conditions = append(conditions, "project = ?")
123 args = append(args, opts.Project)
124 }
125 if len(conditions) > 0 {
126 query += " WHERE " + strings.Join(conditions, " AND ")
127 }
128
129 _, err := s.db.ExecContext(ctx, query, args...)
130 return err
131}
132
133func (s *SQLiteStore) Pin(ctx context.Context, uuid string) error {
134 _, err := s.db.ExecContext(ctx, `UPDATE events SET is_pinned = 1 WHERE uuid = ?`, uuid)

Callers 1

Calls

no outgoing calls

Tested by 1