@@ -0,0 +1,19 @@
|
||||
package repositories
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.aiterp.net/rpdata/api/models"
|
||||
)
|
||||
|
||||
// CharacterRepository is an interface for a database using logs.
|
||||
type CharacterRepository interface {
|
||||
Find(ctx context.Context, id string) (*models.Character, error)
|
||||
FindNick(ctx context.Context, nick string) (*models.Character, error)
|
||||
List(ctx context.Context, filter models.CharacterFilter) ([]*models.Character, error)
|
||||
Insert(ctx context.Context, character models.Character) (*models.Character, error)
|
||||
Update(ctx context.Context, character models.Character, update models.CharacterUpdate) (*models.Character, error)
|
||||
AddNick(ctx context.Context, character models.Character, nick string) (*models.Character, error)
|
||||
RemoveNick(ctx context.Context, character models.Character, nick string) (*models.Character, error)
|
||||
Delete(ctx context.Context, character models.Character) error
|
||||
}
|
||||
@@ -4,7 +4,8 @@ import "errors"
|
||||
|
||||
// A Bundle is a set of repositories.
|
||||
type Bundle struct {
|
||||
Tags TagRepository
|
||||
Characters CharacterRepository
|
||||
Tags TagRepository
|
||||
}
|
||||
|
||||
// ErrNotFound should be returned instead of any database-specific not found error.
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ import (
|
||||
|
||||
// TagRepository is an interface for a database using logs.
|
||||
type TagRepository interface {
|
||||
Find(ctx context.Context, kind, name string) (*models.Tag, error)
|
||||
Find(ctx context.Context, kind models.TagKind, name string) (*models.Tag, error)
|
||||
List(ctx context.Context, filter models.TagFilter) ([]*models.Tag, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user