split store interface

This commit is contained in:
Umputun
2017-12-27 14:11:54 -06:00
parent 3be7821b04
commit c3f8fc2e49
2 changed files with 11 additions and 4 deletions
-2
View File
@@ -1,6 +1,4 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
+11 -2
View File
@@ -51,19 +51,28 @@ type Request struct {
Limit int `json:"limit"`
}
// Interface defines basic CRUD for comments
// Interface combines all store interfaces
type Interface interface {
Accessor
Admin
}
// Accessor defines all usual access ops avail for regular user
type Accessor interface {
Create(comment Comment) (commentID string, err error)
Get(locator Locator, commentID string) (comment Comment, err error)
Put(locator Locator, comment Comment) error
Delete(locator Locator, commentID string) error
Find(request Request) ([]Comment, error)
Last(locator Locator, max int) ([]Comment, error)
GetByID(locator Locator, commentID string) (Comment, error)
GetByUser(locator Locator, userID string) ([]Comment, error)
Count(locator Locator) (int, error)
List(locator Locator) ([]string, error)
}
// Admin defines all store ops avail for admin only
type Admin interface {
Delete(locator Locator, commentID string) error
SetBlock(locator Locator, userID string, status bool) error
IsBlocked(locator Locator, userID string) bool
}