MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / DeleteHook

Method DeleteHook

internal/hooks/manager.go:163–178  ·  view source on GitHub ↗

DeleteHook removes a webhook from Redis. It retrieves the hook to determine its type, then deletes it from both the main registry and the type-specific set using a transaction. Parameters: - ctx: The context for the operation. - hookID: The ID of the hook to delete. Returns: - error: An error if t

(ctx context.Context, hookID string)

Source from the content-addressed store, hash-verified

161// Returns:
162// - error: An error if the deletion fails.
163func (m *redisHookManager) DeleteHook(ctx context.Context, hookID string) error {
164 hook, err := m.GetHook(ctx, hookID)
165 if err != nil {
166 return err
167 }
168
169 key := fmt.Sprintf("%s:%s", hookKeyPrefix, hookID)
170 typeKey := getTypeKey(hook.Type)
171
172 // Use pipeline for atomic operations
173 pipe := m.client.Pipeline()
174 pipe.Del(ctx, key)
175 pipe.SRem(ctx, typeKey, hookID)
176 _, err = pipe.Exec(ctx)
177 return err
178}
179
180// GetHook retrieves a webhook by its ID.
181// It fetches the hook data from Redis and unmarshals it into a Hook struct.

Callers

nothing calls this directly

Calls 2

GetHookMethod · 0.95
getTypeKeyFunction · 0.85

Tested by

no test coverage detected