Added character service and such.
the build was successful

This commit is contained in:
2019-06-10 17:03:52 +02:00
parent 7b253748fe
commit 2a1423d28f
32 changed files with 1551 additions and 277 deletions
+19
View File
@@ -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
}
+2 -1
View File
@@ -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
View File
@@ -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)
}