Documentation
¶
Index ¶
- Variables
- type ListOptions
- type MockRepository
- type Repository
- type Role
- type User
- func (u *User) ApplyChanges(name, email, passwd string, role Role, defaultLangID string, ...) error
- func (u *User) DefaultLangID() string
- func (u *User) Email() string
- func (u *User) ID() string
- func (u *User) ListOptions() ListOptions
- func (u *User) Password() string
- func (u *User) Role() Role
- func (u *User) ToMap() map[string]interface{}
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmailAlreadyExists = errors.New("user with such email already exists")
View Source
var ErrNotFound = errors.New("can not find user in store")
Functions ¶
This section is empty.
Types ¶
type ListOptions ¶
type ListOptions struct {
// contains filtered or unexported fields
}
func NewListOptions ¶
func NewListOptions(hideTranscription bool) ListOptions
func (*ListOptions) ToMap ¶
func (l *ListOptions) ToMap() map[string]interface{}
type MockRepository ¶
mockery --name=Repository --filename=repository_mock.go --output=./ --structname=MockRepository --inpackage MockRepository is an autogenerated mock type for the Repository type
func NewMockRepository ¶
func NewMockRepository(t mockConstructorTestingTNewMockRepository) *MockRepository
NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func (*MockRepository) Create ¶
func (_m *MockRepository) Create(user *User) error
Create provides a mock function with given fields: user
func (*MockRepository) Delete ¶
func (_m *MockRepository) Delete(id string) (int, error)
Delete provides a mock function with given fields: id
func (*MockRepository) Get ¶
func (_m *MockRepository) Get(id string) (*User, error)
Get provides a mock function with given fields: id
func (*MockRepository) GetByEmail ¶
func (_m *MockRepository) GetByEmail(email string) (*User, error)
GetByEmail provides a mock function with given fields: email
func (*MockRepository) Update ¶
func (_m *MockRepository) Update(usr *User) error
Update provides a mock function with given fields: usr
type Repository ¶
type Repository interface { Create(user *User) error // Create saves new user to DB, return ErrEmailAlreadyExists when user with email already exists GetByEmail(email string) (*User, error) // GetByEmail gets user by email, return ErrNotFound if user not exists Get(id string) (*User, error) // Get gets user by id, return ErrNotFound if user not exists Update(usr *User) error // Update saves the updated usr entity to store, return ErrEmailAlreadyExists when user with email already exists Delete(id string) (int, error) // Delete removes user from DB }
Repository User domain repo
type User ¶
type User struct {
// contains filtered or unexported fields
}
func UnmarshalFromDB ¶
func (*User) ApplyChanges ¶
func (*User) DefaultLangID ¶
func (*User) ListOptions ¶
func (u *User) ListOptions() ListOptions
Click to show internal directories.
Click to hide internal directories.