feat(02-01): add Store interface and SQLiteStore implementation
- Store interface with 9 methods covering all persistence operations - SQLiteStore implements all 9 methods with exact SQL from current handlers - NewSQLiteStore sets MaxOpenConns(1) and PRAGMA foreign_keys = ON - UpsertEvent uses ON CONFLICT DO UPDATE with acknowledged_at reset to NULL - AssignTag uses INSERT OR REPLACE for tag_assignments table - golang-migrate v4.19.1 dependency added to go.mod
This commit is contained in:
15
pkg/diunwebhook/store.go
Normal file
15
pkg/diunwebhook/store.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package diunwebhook
|
||||
|
||||
// Store defines all persistence operations. Implementations must be safe
|
||||
// for concurrent use from HTTP handlers.
|
||||
type Store interface {
|
||||
UpsertEvent(event DiunEvent) error
|
||||
GetUpdates() (map[string]UpdateEntry, error)
|
||||
AcknowledgeUpdate(image string) (found bool, err error)
|
||||
ListTags() ([]Tag, error)
|
||||
CreateTag(name string) (Tag, error)
|
||||
DeleteTag(id int) (found bool, err error)
|
||||
AssignTag(image string, tagID int) error
|
||||
UnassignTag(image string) error
|
||||
TagExists(id int) (bool, error)
|
||||
}
|
||||
Reference in New Issue
Block a user