domain

package
v0.9.1-alpha.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2022 License: AGPL-3.0, AGPL-3.0-only Imports: 6 Imported by: 0

Documentation

Index

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 Auth

type Auth struct {
	RegTime time.Time
	ID      uint32
}

Auth is the basic authorization represent a user.

func (Auth) AllowNSFW

func (u Auth) AllowNSFW() bool

AllowNSFW return if current user is allowed to see NSFW resource.

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 CharacterCast

type CharacterCast struct {
	Character model.Character
	Person    model.Person
	Subject   model.Subject
}

type CharacterIDType

type CharacterIDType = uint32

type CharacterRepo

type CharacterRepo interface {
	Get(ctx context.Context, id uint32) (model.Character, error)
	GetPersonRelated(
		ctx context.Context, characterID PersonIDType,
	) ([]model.Character, []model.Subject, []model.PersonCharacterRelation, error)

	GetSubjectRelated(
		ctx context.Context,
		subjectID SubjectIDType,
	) ([]model.Character, []model.CharacterSubjectRelation, error)
}

type EpTypeType

type EpTypeType = int8

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 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 IndexRepo

type IndexRepo interface {
	Get(ctx context.Context, id uint32) (model.Index, error)
	// IsNsfw return if this index contains any nsfw subjects
	// should move this to a field of model.Index
	IsNsfw(ctx context.Context, id uint32) (bool, error)

	CountSubjects(ctx context.Context, id uint32, subjectType model.SubjectType) (int64, error)
	ListSubjects(
		ctx context.Context, id uint32, subjectType model.SubjectType, limit, offset int,
	) ([]IndexSubject, error)
}

type IndexSubject

type IndexSubject struct {
	Comment string
	AddedAt time.Time
	Subject model.Subject
}

type MockAuthRepo

type MockAuthRepo struct {
	mock.Mock
}

MockAuthRepo is an autogenerated mock type for the AuthRepo type

func (*MockAuthRepo) EXPECT

func (_m *MockAuthRepo) EXPECT() *MockAuthRepo_Expecter

func (*MockAuthRepo) GetByToken

func (_m *MockAuthRepo) GetByToken(ctx context.Context, token string) (Auth, error)

GetByToken provides a mock function with given fields: ctx, token

type MockAuthRepo_Expecter

type MockAuthRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockAuthRepo_Expecter) GetByToken

func (_e *MockAuthRepo_Expecter) GetByToken(ctx interface{}, token interface{}) *MockAuthRepo_GetByToken_Call

GetByToken is a helper method to define mock.On call

  • ctx context.Context
  • token string

type MockAuthRepo_GetByToken_Call

type MockAuthRepo_GetByToken_Call struct {
	*mock.Call
}

MockAuthRepo_GetByToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByToken'

func (*MockAuthRepo_GetByToken_Call) Return

func (*MockAuthRepo_GetByToken_Call) Run

type MockCharacterRepo

type MockCharacterRepo struct {
	mock.Mock
}

MockCharacterRepo is an autogenerated mock type for the CharacterRepo type

func (*MockCharacterRepo) EXPECT

func (*MockCharacterRepo) Get

Get provides a mock function with given fields: ctx, id

func (*MockCharacterRepo) GetPersonRelated

func (_m *MockCharacterRepo) GetPersonRelated(ctx context.Context, characterID uint32) ([]model.Character, []model.Subject, []model.PersonCharacterRelation, error)

GetPersonRelated provides a mock function with given fields: ctx, characterID

func (*MockCharacterRepo) GetSubjectRelated

func (_m *MockCharacterRepo) GetSubjectRelated(ctx context.Context, subjectID uint32) ([]model.Character, []model.CharacterSubjectRelation, error)

GetSubjectRelated provides a mock function with given fields: ctx, subjectID

type MockCharacterRepo_Expecter

type MockCharacterRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockCharacterRepo_Expecter) Get

func (_e *MockCharacterRepo_Expecter) Get(ctx interface{}, id interface{}) *MockCharacterRepo_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • id uint32

func (*MockCharacterRepo_Expecter) GetPersonRelated

func (_e *MockCharacterRepo_Expecter) GetPersonRelated(ctx interface{}, characterID interface{}) *MockCharacterRepo_GetPersonRelated_Call

GetPersonRelated is a helper method to define mock.On call

  • ctx context.Context
  • characterID uint32

func (*MockCharacterRepo_Expecter) GetSubjectRelated

func (_e *MockCharacterRepo_Expecter) GetSubjectRelated(ctx interface{}, subjectID interface{}) *MockCharacterRepo_GetSubjectRelated_Call

GetSubjectRelated is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32

type MockCharacterRepo_GetPersonRelated_Call

type MockCharacterRepo_GetPersonRelated_Call struct {
	*mock.Call
}

MockCharacterRepo_GetPersonRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPersonRelated'

func (*MockCharacterRepo_GetPersonRelated_Call) Return

func (*MockCharacterRepo_GetPersonRelated_Call) Run

type MockCharacterRepo_GetSubjectRelated_Call

type MockCharacterRepo_GetSubjectRelated_Call struct {
	*mock.Call
}

MockCharacterRepo_GetSubjectRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubjectRelated'

func (*MockCharacterRepo_GetSubjectRelated_Call) Return

func (*MockCharacterRepo_GetSubjectRelated_Call) Run

type MockCharacterRepo_Get_Call

type MockCharacterRepo_Get_Call struct {
	*mock.Call
}

MockCharacterRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockCharacterRepo_Get_Call) Return

func (*MockCharacterRepo_Get_Call) Run

type MockEpisodeRepo

type MockEpisodeRepo struct {
	mock.Mock
}

MockEpisodeRepo is an autogenerated mock type for the EpisodeRepo type

func (*MockEpisodeRepo) Count

func (_m *MockEpisodeRepo) Count(ctx context.Context, subjectID uint32) (int64, error)

Count provides a mock function with given fields: ctx, subjectID

func (*MockEpisodeRepo) CountByType

func (_m *MockEpisodeRepo) CountByType(ctx context.Context, subjectID uint32, epType int8) (int64, error)

CountByType provides a mock function with given fields: ctx, subjectID, epType

func (*MockEpisodeRepo) EXPECT

func (*MockEpisodeRepo) Get

func (_m *MockEpisodeRepo) Get(ctx context.Context, episodeID uint32) (model.Episode, error)

Get provides a mock function with given fields: ctx, episodeID

func (*MockEpisodeRepo) List

func (_m *MockEpisodeRepo) List(ctx context.Context, subjectID uint32, limit int, offset int) ([]model.Episode, error)

List provides a mock function with given fields: ctx, subjectID, limit, offset

func (*MockEpisodeRepo) ListByType

func (_m *MockEpisodeRepo) ListByType(ctx context.Context, subjectID uint32, epType int8, limit int, offset int) ([]model.Episode, error)

ListByType provides a mock function with given fields: ctx, subjectID, epType, limit, offset

type MockEpisodeRepo_CountByType_Call

type MockEpisodeRepo_CountByType_Call struct {
	*mock.Call
}

MockEpisodeRepo_CountByType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountByType'

func (*MockEpisodeRepo_CountByType_Call) Return

func (*MockEpisodeRepo_CountByType_Call) Run

type MockEpisodeRepo_Count_Call

type MockEpisodeRepo_Count_Call struct {
	*mock.Call
}

MockEpisodeRepo_Count_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Count'

func (*MockEpisodeRepo_Count_Call) Return

func (*MockEpisodeRepo_Count_Call) Run

func (_c *MockEpisodeRepo_Count_Call) Run(run func(ctx context.Context, subjectID uint32)) *MockEpisodeRepo_Count_Call

type MockEpisodeRepo_Expecter

type MockEpisodeRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockEpisodeRepo_Expecter) Count

func (_e *MockEpisodeRepo_Expecter) Count(ctx interface{}, subjectID interface{}) *MockEpisodeRepo_Count_Call

Count is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32

func (*MockEpisodeRepo_Expecter) CountByType

func (_e *MockEpisodeRepo_Expecter) CountByType(ctx interface{}, subjectID interface{}, epType interface{}) *MockEpisodeRepo_CountByType_Call

CountByType is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32
  • epType int8

func (*MockEpisodeRepo_Expecter) Get

func (_e *MockEpisodeRepo_Expecter) Get(ctx interface{}, episodeID interface{}) *MockEpisodeRepo_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • episodeID uint32

func (*MockEpisodeRepo_Expecter) List

func (_e *MockEpisodeRepo_Expecter) List(ctx interface{}, subjectID interface{}, limit interface{}, offset interface{}) *MockEpisodeRepo_List_Call

List is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32
  • limit int
  • offset int

func (*MockEpisodeRepo_Expecter) ListByType

func (_e *MockEpisodeRepo_Expecter) ListByType(ctx interface{}, subjectID interface{}, epType interface{}, limit interface{}, offset interface{}) *MockEpisodeRepo_ListByType_Call

ListByType is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32
  • epType int8
  • limit int
  • offset int

type MockEpisodeRepo_Get_Call

type MockEpisodeRepo_Get_Call struct {
	*mock.Call
}

MockEpisodeRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockEpisodeRepo_Get_Call) Return

func (*MockEpisodeRepo_Get_Call) Run

func (_c *MockEpisodeRepo_Get_Call) Run(run func(ctx context.Context, episodeID uint32)) *MockEpisodeRepo_Get_Call

type MockEpisodeRepo_ListByType_Call

type MockEpisodeRepo_ListByType_Call struct {
	*mock.Call
}

MockEpisodeRepo_ListByType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByType'

func (*MockEpisodeRepo_ListByType_Call) Return

func (*MockEpisodeRepo_ListByType_Call) Run

func (_c *MockEpisodeRepo_ListByType_Call) Run(run func(ctx context.Context, subjectID uint32, epType int8, limit int, offset int)) *MockEpisodeRepo_ListByType_Call

type MockEpisodeRepo_List_Call

type MockEpisodeRepo_List_Call struct {
	*mock.Call
}

MockEpisodeRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'

func (*MockEpisodeRepo_List_Call) Return

func (*MockEpisodeRepo_List_Call) Run

func (_c *MockEpisodeRepo_List_Call) Run(run func(ctx context.Context, subjectID uint32, limit int, offset int)) *MockEpisodeRepo_List_Call

type MockIndexRepo

type MockIndexRepo struct {
	mock.Mock
}

MockIndexRepo is an autogenerated mock type for the IndexRepo type

func (*MockIndexRepo) CountSubjects

func (_m *MockIndexRepo) CountSubjects(ctx context.Context, id uint32, subjectType uint8) (int64, error)

CountSubjects provides a mock function with given fields: ctx, id, subjectType

func (*MockIndexRepo) EXPECT

func (_m *MockIndexRepo) EXPECT() *MockIndexRepo_Expecter

func (*MockIndexRepo) Get

func (_m *MockIndexRepo) Get(ctx context.Context, id uint32) (model.Index, error)

Get provides a mock function with given fields: ctx, id

func (*MockIndexRepo) IsNsfw

func (_m *MockIndexRepo) IsNsfw(ctx context.Context, id uint32) (bool, error)

IsNsfw provides a mock function with given fields: ctx, id

func (*MockIndexRepo) ListSubjects

func (_m *MockIndexRepo) ListSubjects(ctx context.Context, id uint32, subjectType uint8, limit int, offset int) ([]IndexSubject, error)

ListSubjects provides a mock function with given fields: ctx, id, subjectType, limit, offset

type MockIndexRepo_CountSubjects_Call

type MockIndexRepo_CountSubjects_Call struct {
	*mock.Call
}

MockIndexRepo_CountSubjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountSubjects'

func (*MockIndexRepo_CountSubjects_Call) Return

func (*MockIndexRepo_CountSubjects_Call) Run

type MockIndexRepo_Expecter

type MockIndexRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockIndexRepo_Expecter) CountSubjects

func (_e *MockIndexRepo_Expecter) CountSubjects(ctx interface{}, id interface{}, subjectType interface{}) *MockIndexRepo_CountSubjects_Call

CountSubjects is a helper method to define mock.On call

  • ctx context.Context
  • id uint32
  • subjectType uint8

func (*MockIndexRepo_Expecter) Get

func (_e *MockIndexRepo_Expecter) Get(ctx interface{}, id interface{}) *MockIndexRepo_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • id uint32

func (*MockIndexRepo_Expecter) IsNsfw

func (_e *MockIndexRepo_Expecter) IsNsfw(ctx interface{}, id interface{}) *MockIndexRepo_IsNsfw_Call

IsNsfw is a helper method to define mock.On call

  • ctx context.Context
  • id uint32

func (*MockIndexRepo_Expecter) ListSubjects

func (_e *MockIndexRepo_Expecter) ListSubjects(ctx interface{}, id interface{}, subjectType interface{}, limit interface{}, offset interface{}) *MockIndexRepo_ListSubjects_Call

ListSubjects is a helper method to define mock.On call

  • ctx context.Context
  • id uint32
  • subjectType uint8
  • limit int
  • offset int

type MockIndexRepo_Get_Call

type MockIndexRepo_Get_Call struct {
	*mock.Call
}

MockIndexRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockIndexRepo_Get_Call) Return

func (*MockIndexRepo_Get_Call) Run

type MockIndexRepo_IsNsfw_Call

type MockIndexRepo_IsNsfw_Call struct {
	*mock.Call
}

MockIndexRepo_IsNsfw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsNsfw'

func (*MockIndexRepo_IsNsfw_Call) Return

func (*MockIndexRepo_IsNsfw_Call) Run

type MockIndexRepo_ListSubjects_Call

type MockIndexRepo_ListSubjects_Call struct {
	*mock.Call
}

MockIndexRepo_ListSubjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubjects'

func (*MockIndexRepo_ListSubjects_Call) Return

func (*MockIndexRepo_ListSubjects_Call) Run

func (_c *MockIndexRepo_ListSubjects_Call) Run(run func(ctx context.Context, id uint32, subjectType uint8, limit int, offset int)) *MockIndexRepo_ListSubjects_Call

type MockPersonRepo

type MockPersonRepo struct {
	mock.Mock
}

MockPersonRepo is an autogenerated mock type for the PersonRepo type

func (*MockPersonRepo) EXPECT

func (*MockPersonRepo) Get

func (_m *MockPersonRepo) Get(ctx context.Context, id uint32) (model.Person, error)

Get provides a mock function with given fields: ctx, id

func (*MockPersonRepo) GetActors

func (_m *MockPersonRepo) GetActors(ctx context.Context, subjectID uint32, characterIDs ...uint32) (map[uint32][]model.Person, error)

GetActors provides a mock function with given fields: ctx, subjectID, characterIDs

func (*MockPersonRepo) GetCharacterRelated

func (_m *MockPersonRepo) GetCharacterRelated(ctx context.Context, subjectID uint32) ([]CharacterCast, error)

GetCharacterRelated provides a mock function with given fields: ctx, subjectID

func (*MockPersonRepo) GetSubjectRelated

func (_m *MockPersonRepo) GetSubjectRelated(ctx context.Context, subjectID uint32) ([]model.Person, []model.PersonSubjectRelation, error)

GetSubjectRelated provides a mock function with given fields: ctx, subjectID

type MockPersonRepo_Expecter

type MockPersonRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockPersonRepo_Expecter) Get

func (_e *MockPersonRepo_Expecter) Get(ctx interface{}, id interface{}) *MockPersonRepo_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • id uint32

func (*MockPersonRepo_Expecter) GetActors

func (_e *MockPersonRepo_Expecter) GetActors(ctx interface{}, subjectID interface{}, characterIDs ...interface{}) *MockPersonRepo_GetActors_Call

GetActors is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32
  • characterIDs ...uint32

func (*MockPersonRepo_Expecter) GetCharacterRelated

func (_e *MockPersonRepo_Expecter) GetCharacterRelated(ctx interface{}, subjectID interface{}) *MockPersonRepo_GetCharacterRelated_Call

GetCharacterRelated is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32

func (*MockPersonRepo_Expecter) GetSubjectRelated

func (_e *MockPersonRepo_Expecter) GetSubjectRelated(ctx interface{}, subjectID interface{}) *MockPersonRepo_GetSubjectRelated_Call

GetSubjectRelated is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32

type MockPersonRepo_GetActors_Call

type MockPersonRepo_GetActors_Call struct {
	*mock.Call
}

MockPersonRepo_GetActors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActors'

func (*MockPersonRepo_GetActors_Call) Return

func (*MockPersonRepo_GetActors_Call) Run

func (_c *MockPersonRepo_GetActors_Call) Run(run func(ctx context.Context, subjectID uint32, characterIDs ...uint32)) *MockPersonRepo_GetActors_Call

type MockPersonRepo_GetCharacterRelated_Call

type MockPersonRepo_GetCharacterRelated_Call struct {
	*mock.Call
}

MockPersonRepo_GetCharacterRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCharacterRelated'

func (*MockPersonRepo_GetCharacterRelated_Call) Return

func (*MockPersonRepo_GetCharacterRelated_Call) Run

type MockPersonRepo_GetSubjectRelated_Call

type MockPersonRepo_GetSubjectRelated_Call struct {
	*mock.Call
}

MockPersonRepo_GetSubjectRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubjectRelated'

func (*MockPersonRepo_GetSubjectRelated_Call) Return

func (*MockPersonRepo_GetSubjectRelated_Call) Run

type MockPersonRepo_Get_Call

type MockPersonRepo_Get_Call struct {
	*mock.Call
}

MockPersonRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockPersonRepo_Get_Call) Return

func (*MockPersonRepo_Get_Call) Run

type MockSubjectRepo

type MockSubjectRepo struct {
	mock.Mock
}

MockSubjectRepo is an autogenerated mock type for the SubjectRepo type

func (*MockSubjectRepo) EXPECT

func (*MockSubjectRepo) Get

func (_m *MockSubjectRepo) Get(ctx context.Context, id uint32) (model.Subject, error)

Get provides a mock function with given fields: ctx, id

func (*MockSubjectRepo) GetCharacterRelated

func (_m *MockSubjectRepo) GetCharacterRelated(ctx context.Context, characterID uint32) ([]model.Subject, []model.CharacterSubjectRelation, error)

GetCharacterRelated provides a mock function with given fields: ctx, characterID

func (*MockSubjectRepo) GetPersonRelated

func (_m *MockSubjectRepo) GetPersonRelated(ctx context.Context, personID uint32) ([]model.Subject, []model.PersonSubjectRelation, error)

GetPersonRelated provides a mock function with given fields: ctx, personID

func (*MockSubjectRepo) GetSubjectRelated

func (_m *MockSubjectRepo) GetSubjectRelated(ctx context.Context, subjectID uint32) ([]model.Subject, []model.SubjectInternalRelation, error)

GetSubjectRelated provides a mock function with given fields: ctx, subjectID

type MockSubjectRepo_Expecter

type MockSubjectRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockSubjectRepo_Expecter) Get

func (_e *MockSubjectRepo_Expecter) Get(ctx interface{}, id interface{}) *MockSubjectRepo_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • id uint32

func (*MockSubjectRepo_Expecter) GetCharacterRelated

func (_e *MockSubjectRepo_Expecter) GetCharacterRelated(ctx interface{}, characterID interface{}) *MockSubjectRepo_GetCharacterRelated_Call

GetCharacterRelated is a helper method to define mock.On call

  • ctx context.Context
  • characterID uint32

func (*MockSubjectRepo_Expecter) GetPersonRelated

func (_e *MockSubjectRepo_Expecter) GetPersonRelated(ctx interface{}, personID interface{}) *MockSubjectRepo_GetPersonRelated_Call

GetPersonRelated is a helper method to define mock.On call

  • ctx context.Context
  • personID uint32

func (*MockSubjectRepo_Expecter) GetSubjectRelated

func (_e *MockSubjectRepo_Expecter) GetSubjectRelated(ctx interface{}, subjectID interface{}) *MockSubjectRepo_GetSubjectRelated_Call

GetSubjectRelated is a helper method to define mock.On call

  • ctx context.Context
  • subjectID uint32

type MockSubjectRepo_GetCharacterRelated_Call

type MockSubjectRepo_GetCharacterRelated_Call struct {
	*mock.Call
}

MockSubjectRepo_GetCharacterRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCharacterRelated'

func (*MockSubjectRepo_GetCharacterRelated_Call) Return

func (*MockSubjectRepo_GetCharacterRelated_Call) Run

type MockSubjectRepo_GetPersonRelated_Call

type MockSubjectRepo_GetPersonRelated_Call struct {
	*mock.Call
}

MockSubjectRepo_GetPersonRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPersonRelated'

func (*MockSubjectRepo_GetPersonRelated_Call) Return

func (*MockSubjectRepo_GetPersonRelated_Call) Run

type MockSubjectRepo_GetSubjectRelated_Call

type MockSubjectRepo_GetSubjectRelated_Call struct {
	*mock.Call
}

MockSubjectRepo_GetSubjectRelated_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSubjectRelated'

func (*MockSubjectRepo_GetSubjectRelated_Call) Return

func (*MockSubjectRepo_GetSubjectRelated_Call) Run

type MockSubjectRepo_Get_Call

type MockSubjectRepo_Get_Call struct {
	*mock.Call
}

MockSubjectRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockSubjectRepo_Get_Call) Return

func (*MockSubjectRepo_Get_Call) Run

type MockSubjectService

type MockSubjectService struct {
	mock.Mock
}

MockSubjectService is an autogenerated mock type for the SubjectService type

func (*MockSubjectService) EXPECT

func (*MockSubjectService) Get

Get provides a mock function with given fields: ctx, id

type MockSubjectService_Expecter

type MockSubjectService_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockSubjectService_Expecter) Get

func (_e *MockSubjectService_Expecter) Get(ctx interface{}, id interface{}) *MockSubjectService_Get_Call

Get is a helper method to define mock.On call

  • ctx context.Context
  • id uint32

type MockSubjectService_Get_Call

type MockSubjectService_Get_Call struct {
	*mock.Call
}

MockSubjectService_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'

func (*MockSubjectService_Get_Call) Return

func (*MockSubjectService_Get_Call) Run

type MockUserRepo

type MockUserRepo struct {
	mock.Mock
}

MockUserRepo is an autogenerated mock type for the UserRepo type

func (*MockUserRepo) CountCollections

func (_m *MockUserRepo) CountCollections(ctx context.Context, userID uint32, subjectType uint8, collectionType uint8, showPrivate bool) (int64, error)

CountCollections provides a mock function with given fields: ctx, userID, subjectType, collectionType, showPrivate

func (*MockUserRepo) EXPECT

func (_m *MockUserRepo) EXPECT() *MockUserRepo_Expecter

func (*MockUserRepo) GetByID

func (_m *MockUserRepo) GetByID(ctx context.Context, userID uint32) (model.User, error)

GetByID provides a mock function with given fields: ctx, userID

func (*MockUserRepo) GetByIDs

func (_m *MockUserRepo) GetByIDs(ctx context.Context, ids ...uint32) (map[uint32]model.User, error)

GetByIDs provides a mock function with given fields: ctx, ids

func (*MockUserRepo) GetByName

func (_m *MockUserRepo) GetByName(ctx context.Context, username string) (model.User, error)

GetByName provides a mock function with given fields: ctx, username

func (*MockUserRepo) ListCollections

func (_m *MockUserRepo) ListCollections(ctx context.Context, userID uint32, subjectType uint8, collectionType uint8, showPrivate bool, limit int, offset int) ([]model.Collection, error)

ListCollections provides a mock function with given fields: ctx, userID, subjectType, collectionType, showPrivate, limit, offset

type MockUserRepo_CountCollections_Call

type MockUserRepo_CountCollections_Call struct {
	*mock.Call
}

MockUserRepo_CountCollections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CountCollections'

func (*MockUserRepo_CountCollections_Call) Return

func (*MockUserRepo_CountCollections_Call) Run

func (_c *MockUserRepo_CountCollections_Call) Run(run func(ctx context.Context, userID uint32, subjectType uint8, collectionType uint8, showPrivate bool)) *MockUserRepo_CountCollections_Call

type MockUserRepo_Expecter

type MockUserRepo_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockUserRepo_Expecter) CountCollections

func (_e *MockUserRepo_Expecter) CountCollections(ctx interface{}, userID interface{}, subjectType interface{}, collectionType interface{}, showPrivate interface{}) *MockUserRepo_CountCollections_Call

CountCollections is a helper method to define mock.On call

  • ctx context.Context
  • userID uint32
  • subjectType uint8
  • collectionType uint8
  • showPrivate bool

func (*MockUserRepo_Expecter) GetByID

func (_e *MockUserRepo_Expecter) GetByID(ctx interface{}, userID interface{}) *MockUserRepo_GetByID_Call

GetByID is a helper method to define mock.On call

  • ctx context.Context
  • userID uint32

func (*MockUserRepo_Expecter) GetByIDs

func (_e *MockUserRepo_Expecter) GetByIDs(ctx interface{}, ids ...interface{}) *MockUserRepo_GetByIDs_Call

GetByIDs is a helper method to define mock.On call

  • ctx context.Context
  • ids ...uint32

func (*MockUserRepo_Expecter) GetByName

func (_e *MockUserRepo_Expecter) GetByName(ctx interface{}, username interface{}) *MockUserRepo_GetByName_Call

GetByName is a helper method to define mock.On call

  • ctx context.Context
  • username string

func (*MockUserRepo_Expecter) ListCollections

func (_e *MockUserRepo_Expecter) ListCollections(ctx interface{}, userID interface{}, subjectType interface{}, collectionType interface{}, showPrivate interface{}, limit interface{}, offset interface{}) *MockUserRepo_ListCollections_Call

ListCollections is a helper method to define mock.On call

  • ctx context.Context
  • userID uint32
  • subjectType uint8
  • collectionType uint8
  • showPrivate bool
  • limit int
  • offset int

type MockUserRepo_GetByID_Call

type MockUserRepo_GetByID_Call struct {
	*mock.Call
}

MockUserRepo_GetByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByID'

func (*MockUserRepo_GetByID_Call) Return

func (*MockUserRepo_GetByID_Call) Run

type MockUserRepo_GetByIDs_Call

type MockUserRepo_GetByIDs_Call struct {
	*mock.Call
}

MockUserRepo_GetByIDs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByIDs'

func (*MockUserRepo_GetByIDs_Call) Return

func (*MockUserRepo_GetByIDs_Call) Run

type MockUserRepo_GetByName_Call

type MockUserRepo_GetByName_Call struct {
	*mock.Call
}

MockUserRepo_GetByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByName'

func (*MockUserRepo_GetByName_Call) Return

func (*MockUserRepo_GetByName_Call) Run

type MockUserRepo_ListCollections_Call

type MockUserRepo_ListCollections_Call struct {
	*mock.Call
}

MockUserRepo_ListCollections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCollections'

func (*MockUserRepo_ListCollections_Call) Return

func (*MockUserRepo_ListCollections_Call) Run

func (_c *MockUserRepo_ListCollections_Call) Run(run func(ctx context.Context, userID uint32, subjectType uint8, collectionType uint8, showPrivate bool, limit int, offset int)) *MockUserRepo_ListCollections_Call

type PersonIDType

type PersonIDType = uint32

type PersonRepo

type PersonRepo interface {
	Get(ctx context.Context, id uint32) (model.Person, error)

	GetSubjectRelated(
		ctx context.Context,
		subjectID SubjectIDType,
	) ([]model.Person, []model.PersonSubjectRelation, error)

	GetActors(
		ctx context.Context,
		subjectID SubjectIDType,
		characterIDs ...CharacterIDType,
	) (map[CharacterIDType][]model.Person, error)

	GetCharacterRelated(
		ctx context.Context,
		subjectID CharacterIDType,
	) ([]CharacterCast, error)
}

type SubjectIDType

type SubjectIDType = uint32 // in case we need future change, but I guess not...

type SubjectRepo

type SubjectRepo interface {
	// Get return a repository model.
	Get(ctx context.Context, id uint32) (model.Subject, error)

	GetPersonRelated(
		ctx context.Context, personID PersonIDType,
	) ([]model.Subject, []model.PersonSubjectRelation, error)

	GetCharacterRelated(
		ctx context.Context, characterID PersonIDType,
	) ([]model.Subject, []model.CharacterSubjectRelation, error)

	GetSubjectRelated(
		ctx context.Context, subjectID SubjectIDType,
	) ([]model.Subject, []model.SubjectInternalRelation, error)
}

type SubjectService

type SubjectService interface {
	// Get return a repository model.
	Get(ctx context.Context, id uint32) (model.Subject, 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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL