37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
package datastore
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"git.itzana.me/strafesnet/maps-service/internal/model"
|
|
)
|
|
|
|
var (
|
|
ErrNotExist = errors.New("resource does not exist")
|
|
)
|
|
|
|
type Datastore interface {
|
|
Users() Users
|
|
Submissions() Submissions
|
|
}
|
|
|
|
|
|
type Users interface {
|
|
Get(ctx context.Context, id int64) (model.User, error)
|
|
GetList(ctx context.Context, id []int64) ([]model.User, error)
|
|
Create(ctx context.Context, user model.User) (model.User, error)
|
|
Update(ctx context.Context, id int64, values OptionalMap) error
|
|
Delete(ctx context.Context, id int64) error
|
|
List(ctx context.Context, filters OptionalMap, page model.Page) ([]model.User, error)
|
|
}
|
|
|
|
type Submissions interface {
|
|
Get(ctx context.Context, id int64) (model.Submission, error)
|
|
GetList(ctx context.Context, id []int64) ([]model.Submission, error)
|
|
Create(ctx context.Context, time model.Submission) (model.Submission, error)
|
|
Update(ctx context.Context, id int64, values OptionalMap) error
|
|
Delete(ctx context.Context, id int64) error
|
|
List(ctx context.Context, filters OptionalMap, page model.Page) ([]model.Submission, error)
|
|
}
|