query

package
v0.0.0-...-187a358 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllLangs

type AllLangs struct {
	AuthorID string `validate:"required"`
}

type AllLangsHandler

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

func NewAllLangsHandler

func NewAllLangsHandler(langRepo LangViewRepository, validate *validator.Validate) AllLangsHandler

func (AllLangsHandler) Handle

func (h AllLangsHandler) Handle(query AllLangs) ([]LangView, error)

type AllRolesHandler

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

func NewAllRolesHandler

func NewAllRolesHandler() AllRolesHandler

func (AllRolesHandler) Handle

func (h AllRolesHandler) Handle() ([]RoleView, error)

type AllTags

type AllTags struct {
	AuthorID string `validate:"required"`
}

AllTags get all tags for author query

type AllTagsHandler

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

AllTagsHandler get all tags for author query

func NewAllTagsHandler

func NewAllTagsHandler(tagRepository TagViewRepository, validate *validator.Validate) AllTagsHandler

func (AllTagsHandler) Handle

func (h AllTagsHandler) Handle(query AllTags) ([]TagView, error)

Handle performs query to receive all tags for author

type AllUsersHandler

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

AllUsersHandler get all users

func NewAllUsersHandler

func NewAllUsersHandler(userRepo UserViewRepository) AllUsersHandler

func (AllUsersHandler) Handle

func (h AllUsersHandler) Handle() ([]UserView, error)

Handle performs query to receive all tags for author

type LangView

type LangView struct {
	ID   string
	Name string
}

type LangViewRepository

type LangViewRepository interface {
	GetAllViews(authorID string) ([]LangView, error)
	GetView(id, authorID string) (LangView, error)
}

type LastTranslationViews

type LastTranslationViews struct {
	Views        []TranslationView
	TotalRecords int
}

type MockLangViewRepository

type MockLangViewRepository struct {
	mock.Mock
}

mockery --name=LangViewRepository --filename=lang_view_repository_mock.go --output=./ --structname=MockLangViewRepository --inpackage MockLangViewRepository is an autogenerated mock type for the LangViewRepository type

func NewMockLangViewRepository

func NewMockLangViewRepository(t mockConstructorTestingTNewMockLangViewRepository) *MockLangViewRepository

NewMockLangViewRepository creates a new instance of MockLangViewRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockLangViewRepository) GetAllViews

func (_m *MockLangViewRepository) GetAllViews(authorID string) ([]LangView, error)

GetAllViews provides a mock function with given fields: authorID

func (*MockLangViewRepository) GetView

func (_m *MockLangViewRepository) GetView(id string, authorID string) (LangView, error)

GetView provides a mock function with given fields: id, authorID

type MockTagViewRepository

type MockTagViewRepository struct {
	mock.Mock
}

mockery --name=TagViewRepository --filename=tag_view_repository_mock.go --output=./ --structname=MockTagViewRepository --inpackage MockTagViewRepository is an autogenerated mock type for the TagViewRepository type

func NewMockTagViewRepository

func NewMockTagViewRepository(t mockConstructorTestingTNewMockTagViewRepository) *MockTagViewRepository

NewMockTagViewRepository creates a new instance of MockTagViewRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockTagViewRepository) GetAllViews

func (_m *MockTagViewRepository) GetAllViews(authorID string) ([]TagView, error)

GetAllViews provides a mock function with given fields: authorID

func (*MockTagViewRepository) GetView

func (_m *MockTagViewRepository) GetView(id string, authorID string) (TagView, error)

GetView provides a mock function with given fields: id, authorID

func (*MockTagViewRepository) GetViews

func (_m *MockTagViewRepository) GetViews(ids []string, authorID string) ([]TagView, error)

GetViews provides a mock function with given fields: ids, authorID

type MockTranslationViewRepository

type MockTranslationViewRepository struct {
	mock.Mock
}

mockery --name=TranslationViewRepository --filename=translation_view_repository_mock.go --output=./ --structname=MockTranslationViewRepository --inpackage MockTranslationViewRepository is an autogenerated mock type for the TranslationViewRepository type

func NewMockTranslationViewRepository

func NewMockTranslationViewRepository(t mockConstructorTestingTNewMockTranslationViewRepository) *MockTranslationViewRepository

NewMockTranslationViewRepository creates a new instance of MockTranslationViewRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockTranslationViewRepository) GetLastViewsBySourcePart

func (_m *MockTranslationViewRepository) GetLastViewsBySourcePart(authorID string, langID string, sourcePart string, pageSize int, page int) (LastTranslationViews, error)

GetLastViewsBySourcePart provides a mock function with given fields: authorID, langID, sourcePart, pageSize, page

func (*MockTranslationViewRepository) GetLastViewsByTags

func (_m *MockTranslationViewRepository) GetLastViewsByTags(authorID string, langID string, pageSize int, page int, tagIds []string) (LastTranslationViews, error)

GetLastViewsByTags provides a mock function with given fields: authorID, langID, pageSize, page, tagIds

func (*MockTranslationViewRepository) GetLastViewsByTargetPart

func (_m *MockTranslationViewRepository) GetLastViewsByTargetPart(authorID string, langID string, targetPart string, pageSize int, page int) (LastTranslationViews, error)

GetLastViewsByTargetPart provides a mock function with given fields: authorID, langID, targetPart, pageSize, page

func (*MockTranslationViewRepository) GetRandomViews

func (_m *MockTranslationViewRepository) GetRandomViews(authorID string, langID string, tagIds []string, limit int) (RandomViews, error)

GetRandomViews provides a mock function with given fields: authorID, langID, tagIds, limit

func (*MockTranslationViewRepository) GetView

func (_m *MockTranslationViewRepository) GetView(id string, authorID string) (TranslationView, error)

GetView provides a mock function with given fields: id, authorID

type MockUserViewRepository

type MockUserViewRepository struct {
	mock.Mock
}

mockery --name=UserViewRepository --filename=user_view_repository_mock.go --output=./ --structname=MockUserViewRepository --inpackage MockUserViewRepository is an autogenerated mock type for the UserViewRepository type

func NewMockUserViewRepository

func NewMockUserViewRepository(t mockConstructorTestingTNewMockUserViewRepository) *MockUserViewRepository

NewMockUserViewRepository creates a new instance of MockUserViewRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockUserViewRepository) GetAllViews

func (_m *MockUserViewRepository) GetAllViews() ([]UserView, error)

GetAllViews provides a mock function with given fields:

func (*MockUserViewRepository) GetView

func (_m *MockUserViewRepository) GetView(id string) (UserView, error)

GetView provides a mock function with given fields: id

type RandomTranslations

type RandomTranslations struct {
	AuthorID string `validate:"required"`
	LangID   string `validate:"required"`
	TagIds   []string
	Limit    int `validate:"gte=1,lte=200"`
}

type RandomTranslationsHandler

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

func NewRandomTranslationsHandler

func NewRandomTranslationsHandler(translationRepo TranslationViewRepository, validate *validator.Validate) RandomTranslationsHandler

func (RandomTranslationsHandler) Handle

type RandomViews

type RandomViews struct {
	Views []TranslationView
}

type RoleConverter

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

func NewRoleMapper

func NewRoleMapper() *RoleConverter

func (RoleConverter) RoleToView

func (m RoleConverter) RoleToView(role user.Role) (RoleView, error)

type RoleView

type RoleView struct {
	ID      int
	Name    string
	IsAdmin bool
}

type SearchTranslations

type SearchTranslations struct {
	AuthorID   string `validate:"required"`
	LangID     string `validate:"required"`
	TagIds     []string
	SourcePart string `validate:"excluded_with=TargetPart TagIds"`
	TargetPart string `validate:"excluded_with=SourcePart TagIds"`
	PageSize   int    `validate:"gte=1,lte=200"`
	Page       int    `validate:"gte=1"`
}

type SearchTranslationsHandler

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

func NewSearchTranslationsHandler

func NewSearchTranslationsHandler(translationRepo TranslationViewRepository, validate *validator.Validate) SearchTranslationsHandler

func (SearchTranslationsHandler) Handle

type SingleLang

type SingleLang struct {
	ID       string `validate:"required"`
	AuthorID string `validate:"required"`
}

type SingleLangHandler

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

func NewSingleLangHandler

func NewSingleLangHandler(langRepo LangViewRepository, validate *validator.Validate) SingleLangHandler

func (SingleLangHandler) Handle

func (h SingleLangHandler) Handle(cmd SingleLang) (LangView, error)

type SingleTag

type SingleTag struct {
	ID       string `validate:"required"`
	AuthorID string `validate:"required"`
}

SingleTag get tag by ID and authorID query

type SingleTagHandler

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

SingleTagHandler get tag query handler

func NewSingleTagHandler

func NewSingleTagHandler(tagRepo TagViewRepository, validate *validator.Validate) SingleTagHandler

func (SingleTagHandler) Handle

func (h SingleTagHandler) Handle(cmd SingleTag) (TagView, error)

Handle performs query to get tag by ID and authorID

type SingleTranslation

type SingleTranslation struct {
	ID       string `validate:"required"`
	AuthorID string `validate:"required"`
}

SingleTranslation get translation by ID and authorID query

type SingleTranslationHandler

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

SingleTranslationHandler get translation query handler

func NewSingleTranslationHandler

func NewSingleTranslationHandler(translationRepo TranslationViewRepository, validate *validator.Validate) SingleTranslationHandler

func (SingleTranslationHandler) Handle

Handle performs query to get translation by ID and authorID

type SingleUser

type SingleUser struct {
	ID string `validate:"required"`
}

SingleUser get user by ID

type SingleUserHandler

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

SingleUserHandler get tag query handler

func NewSingleUserHandler

func NewSingleUserHandler(userRepo UserViewRepository, validate *validator.Validate) SingleUserHandler

func (SingleUserHandler) Handle

func (h SingleUserHandler) Handle(cmd SingleUser) (UserView, error)

Handle performs query to get user by ID

type TagView

type TagView struct {
	ID   string
	Name string
}

type TagViewRepository

type TagViewRepository interface {
	GetAllViews(authorID string) ([]TagView, error)
	GetView(id, authorID string) (TagView, error)
	GetViews(ids []string, authorID string) ([]TagView, error)
}

type TranslationView

type TranslationView struct {
	ID            string
	Source        string
	Transcription string
	Target        string
	Example       string
	Tags          []TagView
	CreatedAd     time.Time
	Lang          LangView
}

type TranslationViewRepository

type TranslationViewRepository interface {
	GetView(id, authorID string) (TranslationView, error)
	GetLastViewsByTags(authorID, langID string, pageSize, page int, tagIds []string) (LastTranslationViews, error)
	GetRandomViews(authorID, langID string, tagIds []string, limit int) (RandomViews, error)
	GetLastViewsBySourcePart(authorID, langID, sourcePart string, pageSize, page int) (LastTranslationViews, error)
	GetLastViewsByTargetPart(authorID, langID, targetPart string, pageSize, page int) (LastTranslationViews, error)
}

type UserView

type UserView struct {
	ID          string
	Name        string
	Email       string
	Role        RoleView
	DefaultLang LangView
}

type UserViewRepository

type UserViewRepository interface {
	GetAllViews() ([]UserView, error)
	GetView(id string) (UserView, error)
}

Jump to

Keyboard shortcuts

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