maps-service/pkg/datastore/datastore.go

26 lines
768 B
Go
Raw Normal View History

2024-11-26 13:36:40 -08:00
package datastore
import (
"context"
"errors"
2024-11-26 18:30:58 -05:00
"git.itzana.me/strafesnet/maps-service/pkg/model"
2024-11-26 13:36:40 -08:00
)
var (
ErrNotExist = errors.New("resource does not exist")
)
type Datastore interface {
2024-11-26 18:30:58 -05:00
Submissions() Submissions
2024-11-26 13:36:40 -08:00
}
2024-11-26 18:30:58 -05:00
type Submissions interface {
Get(ctx context.Context, id int64) (model.Submission, error)
2024-11-27 15:14:50 -08:00
GetList(ctx context.Context, id []int64) ([]model.Submission, error)
Create(ctx context.Context, smap model.Submission) (model.Submission, error)
Update(ctx context.Context, id int64, values OptionalMap) error
2024-11-27 18:57:42 -08:00
IfStatusThenUpdate(ctx context.Context, id int64, statuses []model.Status, values OptionalMap) error
2024-11-27 15:14:50 -08:00
Delete(ctx context.Context, id int64) error
List(ctx context.Context, filters OptionalMap, page model.Page) ([]model.Submission, error)
2024-11-26 13:36:40 -08:00
}