Documentation
¶
Index ¶
- Variables
- type Auth
- type AuthRepo
- type CharacterRepo
- type CharacterService
- type EpisodeRepo
- type IndexRepo
- type IndexSubject
- type PersonCharacterRelation
- type PersonRepo
- type PersonService
- type RevisionRepo
- type SubjectCharacterRelation
- type SubjectInternalRelation
- type SubjectPersonRelation
- type SubjectRepo
- type SubjectService
- type UserRepo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("can't find item")
ErrNotFound should be returned when a repo or service can't find an authorization.
Functions ¶
This section is empty.
Types ¶
type AuthRepo ¶
type AuthRepo interface {
// GetByToken return an authorized user by a valid access token.
GetByToken(ctx context.Context, token string) (Auth, error)
}
AuthRepo presents an authorization.
type CharacterRepo ¶
type CharacterRepo interface {
Get(ctx context.Context, id model.CharacterIDType) (model.Character, error)
GetByIDs(ctx context.Context, ids ...model.CharacterIDType) (map[model.CharacterIDType]model.Character, error)
GetPersonRelated(ctx context.Context, personID model.PersonIDType) ([]PersonCharacterRelation, error)
GetSubjectRelated(ctx context.Context, subjectID model.SubjectIDType) ([]SubjectCharacterRelation, error)
}
type CharacterService ¶ added in v0.10.1
type CharacterService interface {
Get(ctx context.Context, id uint32) (model.Character, error)
GetPersonRelated(ctx context.Context, personID model.PersonIDType) ([]model.PersonCharacterRelation, error)
GetSubjectRelated(ctx context.Context, subjectID model.SubjectIDType) ([]model.SubjectCharacterRelation, error)
}
type EpisodeRepo ¶
type EpisodeRepo interface {
Get(ctx context.Context, episodeID uint32) (model.Episode, error)
// Count all episode for a subject.
Count(ctx context.Context, subjectID uint32) (int64, error)
// CountByType count episode for a subject and filter by type.
// This is because 0 means episode type normal.
CountByType(ctx context.Context, subjectID uint32, epType model.EpTypeType) (int64, error)
// List return all episode.
List(ctx context.Context, subjectID uint32, limit int, offset int) ([]model.Episode, error)
// ListByType return episodes filtered by episode type.
ListByType(
ctx context.Context, subjectID uint32, epType enum.EpType, limit int, offset int,
) ([]model.Episode, error)
}
type IndexSubject ¶
type PersonCharacterRelation ¶ added in v0.10.1
type PersonCharacterRelation struct {
CharacterID model.CharacterIDType
PersonID model.PersonIDType
SubjectID model.SubjectIDType
}
type PersonRepo ¶
type PersonRepo interface {
Get(ctx context.Context, id uint32) (model.Person, error)
GetByIDs(ctx context.Context, ids ...model.PersonIDType) (map[model.PersonIDType]model.Person, error)
GetSubjectRelated(ctx context.Context, subjectID model.SubjectIDType) ([]SubjectPersonRelation, error)
GetCharacterRelated(ctx context.Context, subjectID model.CharacterIDType) ([]PersonCharacterRelation, error)
}
type PersonService ¶ added in v0.10.1
type PersonService interface {
Get(ctx context.Context, id uint32) (model.Person, error)
GetSubjectRelated(ctx context.Context, subjectID model.SubjectIDType) ([]model.SubjectPersonRelation, error)
GetCharacterRelated(ctx context.Context, subjectID model.CharacterIDType) ([]model.PersonCharacterRelation, error)
}
type RevisionRepo ¶ added in v0.10.1
type RevisionRepo interface {
CountPersonRelated(ctx context.Context, personID model.PersonIDType) (int64, error)
ListPersonRelated(
ctx context.Context, personID model.PersonIDType, limit int, offset int,
) ([]model.Revision, error)
GetPersonRelated(ctx context.Context, id model.IDType) (model.Revision, error)
CountSubjectRelated(ctx context.Context, id model.SubjectIDType) (int64, error)
ListSubjectRelated(
ctx context.Context, id model.SubjectIDType, limit int, offset int,
) ([]model.Revision, error)
GetSubjectRelated(ctx context.Context, id model.IDType) (model.Revision, error)
CountCharacterRelated(ctx context.Context, characterID model.CharacterIDType) (int64, error)
ListCharacterRelated(
ctx context.Context, characterID model.CharacterIDType, limit int, offset int,
) ([]model.CharacterRevision, error)
GetCharacterRelated(ctx context.Context, id model.IDType) (model.CharacterRevision, error)
}
type SubjectCharacterRelation ¶ added in v0.10.1
type SubjectCharacterRelation struct {
TypeID uint8
SubjectID model.SubjectIDType
CharacterID model.CharacterIDType
}
type SubjectInternalRelation ¶ added in v0.10.1
type SubjectInternalRelation struct {
TypeID uint16
SourceID model.SubjectIDType
DestinationID model.SubjectIDType
}
type SubjectPersonRelation ¶ added in v0.10.1
type SubjectPersonRelation struct {
TypeID uint16
PersonID model.PersonIDType
SubjectID model.SubjectIDType
}
type SubjectRepo ¶
type SubjectRepo interface {
// Get return a repository model.
Get(ctx context.Context, id uint32) (model.Subject, error)
GetByIDs(ctx context.Context, ids ...model.SubjectIDType) (map[model.SubjectIDType]model.Subject, error)
GetPersonRelated(ctx context.Context, personID model.PersonIDType) ([]SubjectPersonRelation, error)
GetCharacterRelated(ctx context.Context, characterID model.PersonIDType) ([]SubjectCharacterRelation, error)
GetSubjectRelated(ctx context.Context, subjectID model.SubjectIDType) ([]SubjectInternalRelation, error)
GetActors(
ctx context.Context, subjectID model.SubjectIDType, characterIDs ...model.CharacterIDType,
) (map[model.CharacterIDType][]model.Person, error)
}
type SubjectService ¶
type SubjectService interface {
// Get return a repository model.
Get(ctx context.Context, id uint32) (model.Subject, error)
GetPersonRelated(ctx context.Context, personID model.PersonIDType) ([]model.SubjectPersonRelation, error)
GetCharacterRelated(ctx context.Context, characterID model.PersonIDType) ([]model.SubjectCharacterRelation, error)
GetSubjectRelated(ctx context.Context, subjectID model.SubjectIDType) ([]model.SubjectInternalRelation, error)
GetActors(
ctx context.Context, subjectID model.SubjectIDType, characterIDs ...model.CharacterIDType,
) (map[model.CharacterIDType][]model.Person, error)
}
type UserRepo ¶
type UserRepo interface {
// GetByID find a user by uid.
GetByID(ctx context.Context, userID uint32) (model.User, error)
// GetByName find a user by username.
GetByName(ctx context.Context, username string) (model.User, error)
GetByIDs(ctx context.Context, ids ...uint32) (map[uint32]model.User, error)
CountCollections(
ctx context.Context,
userID uint32,
subjectType model.SubjectType,
collectionType uint8,
showPrivate bool,
) (int64, error)
ListCollections(
ctx context.Context,
userID uint32,
subjectType model.SubjectType,
collectionType uint8,
showPrivate bool,
limit, offset int,
) ([]model.Collection, error)
}
Click to show internal directories.
Click to hide internal directories.