Basic functionality
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user