- 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
16 lines
516 B
Go
16 lines
516 B
Go
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)
|
|
}
|