Basic functionality

This commit is contained in:
Henri Burau
2024-06-05 18:01:08 +02:00
parent 17f878f088
commit 72dce76e2b
41 changed files with 1568 additions and 176 deletions

View File

@ -12,6 +12,7 @@ import (
type Persistence interface {
CreateCapture(context.Context, *Capture) error
UpdateCapture(context.Context, *Capture) error
GetCaptures(context.Context) ([]Capture, error)
GetCapturesByID(context.Context, int64) (*Capture, error)
DeleteCapture(context.Context, int64) error
@ -68,6 +69,12 @@ func (s *SQLitePersistence) GetCapturesByID(ctx context.Context, id int64) (*Cap
return &capture, err
}
func (s *SQLitePersistence) UpdateCapture(ctx context.Context, capture *Capture) error {
_, err := s.db.NewUpdate().Model(capture).WherePK().Exec(ctx)
return err
}
func (s *SQLitePersistence) DeleteCapture(ctx context.Context, id int64) error {
capture := Capture{
ID: id,