domain

package
v0.0.0-...-964291d Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
View Source
var ErrInvalidToken = errors.New("invalid token")
View Source
var ErrNoSession = errors.New("no session")
View Source
var ErrUserAlreadyExists = errors.New("user already exists")
View Source
var ErrUserNotExist = errors.New("user not exists")

Functions

This section is empty.

Types

type AtomicFn

type AtomicFn = func(txRepo Repository) error

type Domain

type Domain interface {
	SignUp(setup Setup, user User) (newUser User, err error)
	LogIn(setup Setup, user User) (existing User, sessionKey string, err error)
	Delete(setup Setup, user User) (deleted bool, err error)
	VerifyAccount(setup Setup, token string) (verified bool, err error)
	ResetPasswordRequest(setup Setup, user User) (sentTo User, err error)
	VerifyPasswordReset(setup Setup, token string, password string) (updated User, err error)
	Session(setup Setup, token string) (user User, err error)
	Logout(setup Setup, token string) (err error)
}

func NewDomain

func NewDomain(repository Repository, config utils.Config, notifier Notifier) Domain

type ForgetPassword

type ForgetPassword struct {
	ID     uint64
	Token  string
	UserID uint64
}

type MockDomain

type MockDomain struct {
	mock.Mock
}

MockDomain is an autogenerated mock type for the Domain type

func NewMockDomain

func NewMockDomain(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockDomain

NewMockDomain creates a new instance of MockDomain. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockDomain) Delete

func (_m *MockDomain) Delete(setup Setup, user User) (bool, error)

Delete provides a mock function with given fields: setup, user

func (*MockDomain) EXPECT

func (_m *MockDomain) EXPECT() *MockDomain_Expecter

func (*MockDomain) LogIn

func (_m *MockDomain) LogIn(setup Setup, user User) (User, string, error)

LogIn provides a mock function with given fields: setup, user

func (*MockDomain) Logout

func (_m *MockDomain) Logout(setup Setup, token string) error

Logout provides a mock function with given fields: setup, token

func (*MockDomain) ResetPasswordRequest

func (_m *MockDomain) ResetPasswordRequest(setup Setup, user User) (User, error)

ResetPasswordRequest provides a mock function with given fields: setup, user

func (*MockDomain) Session

func (_m *MockDomain) Session(setup Setup, token string) (User, error)

Session provides a mock function with given fields: setup, token

func (*MockDomain) SignUp

func (_m *MockDomain) SignUp(setup Setup, user User) (User, error)

SignUp provides a mock function with given fields: setup, user

func (*MockDomain) VerifyAccount

func (_m *MockDomain) VerifyAccount(setup Setup, token string) (bool, error)

VerifyAccount provides a mock function with given fields: setup, token

func (*MockDomain) VerifyPasswordReset

func (_m *MockDomain) VerifyPasswordReset(setup Setup, token string, password string) (User, error)

VerifyPasswordReset provides a mock function with given fields: setup, token, password

type MockDomain_Delete_Call

type MockDomain_Delete_Call struct {
	*mock.Call
}

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

func (*MockDomain_Delete_Call) Return

func (_c *MockDomain_Delete_Call) Return(deleted bool, err error) *MockDomain_Delete_Call

func (*MockDomain_Delete_Call) Run

func (_c *MockDomain_Delete_Call) Run(run func(setup Setup, user User)) *MockDomain_Delete_Call

func (*MockDomain_Delete_Call) RunAndReturn

func (_c *MockDomain_Delete_Call) RunAndReturn(run func(Setup, User) (bool, error)) *MockDomain_Delete_Call

type MockDomain_Expecter

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

func (*MockDomain_Expecter) Delete

func (_e *MockDomain_Expecter) Delete(setup interface{}, user interface{}) *MockDomain_Delete_Call

Delete is a helper method to define mock.On call

  • setup Setup
  • user User

func (*MockDomain_Expecter) LogIn

func (_e *MockDomain_Expecter) LogIn(setup interface{}, user interface{}) *MockDomain_LogIn_Call

LogIn is a helper method to define mock.On call

  • setup Setup
  • user User

func (*MockDomain_Expecter) Logout

func (_e *MockDomain_Expecter) Logout(setup interface{}, token interface{}) *MockDomain_Logout_Call

Logout is a helper method to define mock.On call

  • setup Setup
  • token string

func (*MockDomain_Expecter) ResetPasswordRequest

func (_e *MockDomain_Expecter) ResetPasswordRequest(setup interface{}, user interface{}) *MockDomain_ResetPasswordRequest_Call

ResetPasswordRequest is a helper method to define mock.On call

  • setup Setup
  • user User

func (*MockDomain_Expecter) Session

func (_e *MockDomain_Expecter) Session(setup interface{}, token interface{}) *MockDomain_Session_Call

Session is a helper method to define mock.On call

  • setup Setup
  • token string

func (*MockDomain_Expecter) SignUp

func (_e *MockDomain_Expecter) SignUp(setup interface{}, user interface{}) *MockDomain_SignUp_Call

SignUp is a helper method to define mock.On call

  • setup Setup
  • user User

func (*MockDomain_Expecter) VerifyAccount

func (_e *MockDomain_Expecter) VerifyAccount(setup interface{}, token interface{}) *MockDomain_VerifyAccount_Call

VerifyAccount is a helper method to define mock.On call

  • setup Setup
  • token string

func (*MockDomain_Expecter) VerifyPasswordReset

func (_e *MockDomain_Expecter) VerifyPasswordReset(setup interface{}, token interface{}, password interface{}) *MockDomain_VerifyPasswordReset_Call

VerifyPasswordReset is a helper method to define mock.On call

  • setup Setup
  • token string
  • password string

type MockDomain_LogIn_Call

type MockDomain_LogIn_Call struct {
	*mock.Call
}

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

func (*MockDomain_LogIn_Call) Return

func (_c *MockDomain_LogIn_Call) Return(existing User, sessionKey string, err error) *MockDomain_LogIn_Call

func (*MockDomain_LogIn_Call) Run

func (_c *MockDomain_LogIn_Call) Run(run func(setup Setup, user User)) *MockDomain_LogIn_Call

func (*MockDomain_LogIn_Call) RunAndReturn

func (_c *MockDomain_LogIn_Call) RunAndReturn(run func(Setup, User) (User, string, error)) *MockDomain_LogIn_Call

type MockDomain_Logout_Call

type MockDomain_Logout_Call struct {
	*mock.Call
}

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

func (*MockDomain_Logout_Call) Return

func (*MockDomain_Logout_Call) Run

func (_c *MockDomain_Logout_Call) Run(run func(setup Setup, token string)) *MockDomain_Logout_Call

func (*MockDomain_Logout_Call) RunAndReturn

func (_c *MockDomain_Logout_Call) RunAndReturn(run func(Setup, string) error) *MockDomain_Logout_Call

type MockDomain_ResetPasswordRequest_Call

type MockDomain_ResetPasswordRequest_Call struct {
	*mock.Call
}

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

func (*MockDomain_ResetPasswordRequest_Call) Return

func (*MockDomain_ResetPasswordRequest_Call) Run

func (*MockDomain_ResetPasswordRequest_Call) RunAndReturn

type MockDomain_Session_Call

type MockDomain_Session_Call struct {
	*mock.Call
}

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

func (*MockDomain_Session_Call) Return

func (*MockDomain_Session_Call) Run

func (_c *MockDomain_Session_Call) Run(run func(setup Setup, token string)) *MockDomain_Session_Call

func (*MockDomain_Session_Call) RunAndReturn

func (_c *MockDomain_Session_Call) RunAndReturn(run func(Setup, string) (User, error)) *MockDomain_Session_Call

type MockDomain_SignUp_Call

type MockDomain_SignUp_Call struct {
	*mock.Call
}

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

func (*MockDomain_SignUp_Call) Return

func (_c *MockDomain_SignUp_Call) Return(newUser User, err error) *MockDomain_SignUp_Call

func (*MockDomain_SignUp_Call) Run

func (_c *MockDomain_SignUp_Call) Run(run func(setup Setup, user User)) *MockDomain_SignUp_Call

func (*MockDomain_SignUp_Call) RunAndReturn

func (_c *MockDomain_SignUp_Call) RunAndReturn(run func(Setup, User) (User, error)) *MockDomain_SignUp_Call

type MockDomain_VerifyAccount_Call

type MockDomain_VerifyAccount_Call struct {
	*mock.Call
}

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

func (*MockDomain_VerifyAccount_Call) Return

func (*MockDomain_VerifyAccount_Call) Run

func (*MockDomain_VerifyAccount_Call) RunAndReturn

type MockDomain_VerifyPasswordReset_Call

type MockDomain_VerifyPasswordReset_Call struct {
	*mock.Call
}

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

func (*MockDomain_VerifyPasswordReset_Call) Return

func (*MockDomain_VerifyPasswordReset_Call) Run

func (*MockDomain_VerifyPasswordReset_Call) RunAndReturn

type MockNotifier

type MockNotifier struct {
	mock.Mock
}

MockNotifier is an autogenerated mock type for the Notifier type

func NewMockNotifier

func NewMockNotifier(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockNotifier

NewMockNotifier creates a new instance of MockNotifier. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockNotifier) EXPECT

func (_m *MockNotifier) EXPECT() *MockNotifier_Expecter

func (*MockNotifier) Send

func (_m *MockNotifier) Send(to string, subject string, text string, html string) error

Send provides a mock function with given fields: to, subject, text, html

type MockNotifier_Expecter

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

func (*MockNotifier_Expecter) Send

func (_e *MockNotifier_Expecter) Send(to interface{}, subject interface{}, text interface{}, html interface{}) *MockNotifier_Send_Call

Send is a helper method to define mock.On call

  • to string
  • subject string
  • text string
  • html string

type MockNotifier_Send_Call

type MockNotifier_Send_Call struct {
	*mock.Call
}

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

func (*MockNotifier_Send_Call) Return

func (*MockNotifier_Send_Call) Run

func (_c *MockNotifier_Send_Call) Run(run func(to string, subject string, text string, html string)) *MockNotifier_Send_Call

func (*MockNotifier_Send_Call) RunAndReturn

type MockRepository

type MockRepository struct {
	mock.Mock
}

MockRepository is an autogenerated mock type for the Repository type

func NewMockRepository

func NewMockRepository(t interface {
	mock.TestingT
	Cleanup(func())
}) *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. The first argument is typically a *testing.T value.

func (*MockRepository) Atomic

func (_m *MockRepository) Atomic(fn func(Repository) error) error

Atomic provides a mock function with given fields: fn

func (*MockRepository) EXPECT

func (*MockRepository) ForgetPassword

func (_m *MockRepository) ForgetPassword(ctx context.Context) RepositoryForgetPassword

ForgetPassword provides a mock function with given fields: ctx

func (*MockRepository) Session

Session provides a mock function with given fields: ctx

func (*MockRepository) User

User provides a mock function with given fields: ctx

func (*MockRepository) VerifyAccount

func (_m *MockRepository) VerifyAccount(ctx context.Context) RepositoryVerifyAccount

VerifyAccount provides a mock function with given fields: ctx

type MockRepositoryForgetPassword

type MockRepositoryForgetPassword struct {
	mock.Mock
}

MockRepositoryForgetPassword is an autogenerated mock type for the RepositoryForgetPassword type

func NewMockRepositoryForgetPassword

func NewMockRepositoryForgetPassword(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRepositoryForgetPassword

NewMockRepositoryForgetPassword creates a new instance of MockRepositoryForgetPassword. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRepositoryForgetPassword) Create

func (_m *MockRepositoryForgetPassword) Create(token string, userId uint64) (ForgetPassword, error)

Create provides a mock function with given fields: token, userId

func (*MockRepositoryForgetPassword) Delete

Delete provides a mock function with given fields: token

func (*MockRepositoryForgetPassword) EXPECT

type MockRepositoryForgetPassword_Create_Call

type MockRepositoryForgetPassword_Create_Call struct {
	*mock.Call
}

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

func (*MockRepositoryForgetPassword_Create_Call) Return

func (*MockRepositoryForgetPassword_Create_Call) Run

func (*MockRepositoryForgetPassword_Create_Call) RunAndReturn

type MockRepositoryForgetPassword_Delete_Call

type MockRepositoryForgetPassword_Delete_Call struct {
	*mock.Call
}

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

func (*MockRepositoryForgetPassword_Delete_Call) Return

func (*MockRepositoryForgetPassword_Delete_Call) Run

func (*MockRepositoryForgetPassword_Delete_Call) RunAndReturn

type MockRepositoryForgetPassword_Expecter

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

func (*MockRepositoryForgetPassword_Expecter) Create

func (_e *MockRepositoryForgetPassword_Expecter) Create(token interface{}, userId interface{}) *MockRepositoryForgetPassword_Create_Call

Create is a helper method to define mock.On call

  • token string
  • userId uint64

func (*MockRepositoryForgetPassword_Expecter) Delete

Delete is a helper method to define mock.On call

  • token string

type MockRepositorySession

type MockRepositorySession struct {
	mock.Mock
}

MockRepositorySession is an autogenerated mock type for the RepositorySession type

func NewMockRepositorySession

func NewMockRepositorySession(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRepositorySession

NewMockRepositorySession creates a new instance of MockRepositorySession. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRepositorySession) Create

func (_m *MockRepositorySession) Create(user User) (Session, error)

Create provides a mock function with given fields: user

func (*MockRepositorySession) Delete

func (_m *MockRepositorySession) Delete(key string) error

Delete provides a mock function with given fields: key

func (*MockRepositorySession) EXPECT

func (*MockRepositorySession) Get

func (_m *MockRepositorySession) Get(key string) (User, error)

Get provides a mock function with given fields: key

type MockRepositorySession_Create_Call

type MockRepositorySession_Create_Call struct {
	*mock.Call
}

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

func (*MockRepositorySession_Create_Call) Return

func (*MockRepositorySession_Create_Call) Run

func (*MockRepositorySession_Create_Call) RunAndReturn

type MockRepositorySession_Delete_Call

type MockRepositorySession_Delete_Call struct {
	*mock.Call
}

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

func (*MockRepositorySession_Delete_Call) Return

func (*MockRepositorySession_Delete_Call) Run

func (*MockRepositorySession_Delete_Call) RunAndReturn

type MockRepositorySession_Expecter

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

func (*MockRepositorySession_Expecter) Create

Create is a helper method to define mock.On call

  • user User

func (*MockRepositorySession_Expecter) Delete

Delete is a helper method to define mock.On call

  • key string

func (*MockRepositorySession_Expecter) Get

Get is a helper method to define mock.On call

  • key string

type MockRepositorySession_Get_Call

type MockRepositorySession_Get_Call struct {
	*mock.Call
}

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

func (*MockRepositorySession_Get_Call) Return

func (*MockRepositorySession_Get_Call) Run

func (*MockRepositorySession_Get_Call) RunAndReturn

type MockRepositoryUser

type MockRepositoryUser struct {
	mock.Mock
}

MockRepositoryUser is an autogenerated mock type for the RepositoryUser type

func NewMockRepositoryUser

func NewMockRepositoryUser(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRepositoryUser

NewMockRepositoryUser creates a new instance of MockRepositoryUser. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRepositoryUser) Create

func (_m *MockRepositoryUser) Create(user User) (User, error)

Create provides a mock function with given fields: user

func (*MockRepositoryUser) Delete

func (_m *MockRepositoryUser) Delete(id uint64) (bool, error)

Delete provides a mock function with given fields: id

func (*MockRepositoryUser) EXPECT

func (*MockRepositoryUser) GetByEmail

func (_m *MockRepositoryUser) GetByEmail(email string) (User, error)

GetByEmail provides a mock function with given fields: email

func (*MockRepositoryUser) GetByUsername

func (_m *MockRepositoryUser) GetByUsername(username string) (User, error)

GetByUsername provides a mock function with given fields: username

func (*MockRepositoryUser) SetPassword

func (_m *MockRepositoryUser) SetPassword(user User, password string) error

SetPassword provides a mock function with given fields: user, password

func (*MockRepositoryUser) Verify

func (_m *MockRepositoryUser) Verify(user User) error

Verify provides a mock function with given fields: user

type MockRepositoryUser_Create_Call

type MockRepositoryUser_Create_Call struct {
	*mock.Call
}

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

func (*MockRepositoryUser_Create_Call) Return

func (*MockRepositoryUser_Create_Call) Run

func (*MockRepositoryUser_Create_Call) RunAndReturn

type MockRepositoryUser_Delete_Call

type MockRepositoryUser_Delete_Call struct {
	*mock.Call
}

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

func (*MockRepositoryUser_Delete_Call) Return

func (*MockRepositoryUser_Delete_Call) Run

func (*MockRepositoryUser_Delete_Call) RunAndReturn

type MockRepositoryUser_Expecter

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

func (*MockRepositoryUser_Expecter) Create

func (_e *MockRepositoryUser_Expecter) Create(user interface{}) *MockRepositoryUser_Create_Call

Create is a helper method to define mock.On call

  • user User

func (*MockRepositoryUser_Expecter) Delete

func (_e *MockRepositoryUser_Expecter) Delete(id interface{}) *MockRepositoryUser_Delete_Call

Delete is a helper method to define mock.On call

  • id uint64

func (*MockRepositoryUser_Expecter) GetByEmail

func (_e *MockRepositoryUser_Expecter) GetByEmail(email interface{}) *MockRepositoryUser_GetByEmail_Call

GetByEmail is a helper method to define mock.On call

  • email string

func (*MockRepositoryUser_Expecter) GetByUsername

func (_e *MockRepositoryUser_Expecter) GetByUsername(username interface{}) *MockRepositoryUser_GetByUsername_Call

GetByUsername is a helper method to define mock.On call

  • username string

func (*MockRepositoryUser_Expecter) SetPassword

func (_e *MockRepositoryUser_Expecter) SetPassword(user interface{}, password interface{}) *MockRepositoryUser_SetPassword_Call

SetPassword is a helper method to define mock.On call

  • user User
  • password string

func (*MockRepositoryUser_Expecter) Verify

func (_e *MockRepositoryUser_Expecter) Verify(user interface{}) *MockRepositoryUser_Verify_Call

Verify is a helper method to define mock.On call

  • user User

type MockRepositoryUser_GetByEmail_Call

type MockRepositoryUser_GetByEmail_Call struct {
	*mock.Call
}

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

func (*MockRepositoryUser_GetByEmail_Call) Return

func (*MockRepositoryUser_GetByEmail_Call) Run

func (*MockRepositoryUser_GetByEmail_Call) RunAndReturn

type MockRepositoryUser_GetByUsername_Call

type MockRepositoryUser_GetByUsername_Call struct {
	*mock.Call
}

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

func (*MockRepositoryUser_GetByUsername_Call) Return

func (*MockRepositoryUser_GetByUsername_Call) Run

func (*MockRepositoryUser_GetByUsername_Call) RunAndReturn

type MockRepositoryUser_SetPassword_Call

type MockRepositoryUser_SetPassword_Call struct {
	*mock.Call
}

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

func (*MockRepositoryUser_SetPassword_Call) Return

func (*MockRepositoryUser_SetPassword_Call) Run

func (*MockRepositoryUser_SetPassword_Call) RunAndReturn

type MockRepositoryUser_Verify_Call

type MockRepositoryUser_Verify_Call struct {
	*mock.Call
}

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

func (*MockRepositoryUser_Verify_Call) Return

func (*MockRepositoryUser_Verify_Call) Run

func (*MockRepositoryUser_Verify_Call) RunAndReturn

type MockRepositoryVerifyAccount

type MockRepositoryVerifyAccount struct {
	mock.Mock
}

MockRepositoryVerifyAccount is an autogenerated mock type for the RepositoryVerifyAccount type

func NewMockRepositoryVerifyAccount

func NewMockRepositoryVerifyAccount(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRepositoryVerifyAccount

NewMockRepositoryVerifyAccount creates a new instance of MockRepositoryVerifyAccount. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRepositoryVerifyAccount) Create

func (_m *MockRepositoryVerifyAccount) Create(token string, userId uint64) (VerifyAccount, error)

Create provides a mock function with given fields: token, userId

func (*MockRepositoryVerifyAccount) EXPECT

func (*MockRepositoryVerifyAccount) Verify

Verify provides a mock function with given fields: token

type MockRepositoryVerifyAccount_Create_Call

type MockRepositoryVerifyAccount_Create_Call struct {
	*mock.Call
}

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

func (*MockRepositoryVerifyAccount_Create_Call) Return

func (*MockRepositoryVerifyAccount_Create_Call) Run

func (*MockRepositoryVerifyAccount_Create_Call) RunAndReturn

type MockRepositoryVerifyAccount_Expecter

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

func (*MockRepositoryVerifyAccount_Expecter) Create

func (_e *MockRepositoryVerifyAccount_Expecter) Create(token interface{}, userId interface{}) *MockRepositoryVerifyAccount_Create_Call

Create is a helper method to define mock.On call

  • token string
  • userId uint64

func (*MockRepositoryVerifyAccount_Expecter) Verify

Verify is a helper method to define mock.On call

  • token string

type MockRepositoryVerifyAccount_Verify_Call

type MockRepositoryVerifyAccount_Verify_Call struct {
	*mock.Call
}

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

func (*MockRepositoryVerifyAccount_Verify_Call) Return

func (*MockRepositoryVerifyAccount_Verify_Call) Run

func (*MockRepositoryVerifyAccount_Verify_Call) RunAndReturn

type MockRepository_Atomic_Call

type MockRepository_Atomic_Call struct {
	*mock.Call
}

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

func (*MockRepository_Atomic_Call) Return

func (*MockRepository_Atomic_Call) Run

func (*MockRepository_Atomic_Call) RunAndReturn

func (_c *MockRepository_Atomic_Call) RunAndReturn(run func(func(Repository) error) error) *MockRepository_Atomic_Call

type MockRepository_Expecter

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

func (*MockRepository_Expecter) Atomic

func (_e *MockRepository_Expecter) Atomic(fn interface{}) *MockRepository_Atomic_Call

Atomic is a helper method to define mock.On call

  • fn func(Repository) error

func (*MockRepository_Expecter) ForgetPassword

func (_e *MockRepository_Expecter) ForgetPassword(ctx interface{}) *MockRepository_ForgetPassword_Call

ForgetPassword is a helper method to define mock.On call

  • ctx context.Context

func (*MockRepository_Expecter) Session

func (_e *MockRepository_Expecter) Session(ctx interface{}) *MockRepository_Session_Call

Session is a helper method to define mock.On call

  • ctx context.Context

func (*MockRepository_Expecter) User

func (_e *MockRepository_Expecter) User(ctx interface{}) *MockRepository_User_Call

User is a helper method to define mock.On call

  • ctx context.Context

func (*MockRepository_Expecter) VerifyAccount

func (_e *MockRepository_Expecter) VerifyAccount(ctx interface{}) *MockRepository_VerifyAccount_Call

VerifyAccount is a helper method to define mock.On call

  • ctx context.Context

type MockRepository_ForgetPassword_Call

type MockRepository_ForgetPassword_Call struct {
	*mock.Call
}

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

func (*MockRepository_ForgetPassword_Call) Return

func (*MockRepository_ForgetPassword_Call) Run

func (*MockRepository_ForgetPassword_Call) RunAndReturn

type MockRepository_Session_Call

type MockRepository_Session_Call struct {
	*mock.Call
}

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

func (*MockRepository_Session_Call) Return

func (*MockRepository_Session_Call) Run

func (*MockRepository_Session_Call) RunAndReturn

type MockRepository_User_Call

type MockRepository_User_Call struct {
	*mock.Call
}

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

func (*MockRepository_User_Call) Return

func (*MockRepository_User_Call) Run

func (*MockRepository_User_Call) RunAndReturn

type MockRepository_VerifyAccount_Call

type MockRepository_VerifyAccount_Call struct {
	*mock.Call
}

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

func (*MockRepository_VerifyAccount_Call) Return

func (*MockRepository_VerifyAccount_Call) Run

func (*MockRepository_VerifyAccount_Call) RunAndReturn

type Notifier

type Notifier interface {
	Send(to string, subject string, text string, html string) error
}

type Repository

type Repository interface {
	Atomic(fn AtomicFn) error
	User(ctx context.Context) RepositoryUser
	VerifyAccount(ctx context.Context) RepositoryVerifyAccount
	ForgetPassword(ctx context.Context) RepositoryForgetPassword
	Session(ctx context.Context) RepositorySession
}

type RepositoryForgetPassword

type RepositoryForgetPassword interface {
	Create(token string, userId uint64) (request ForgetPassword, err error)
	Delete(token string) (request ForgetPassword, err error)
}

type RepositorySession

type RepositorySession interface {
	Create(user User) (session Session, err error)
	Get(key string) (user User, err error)
	Delete(key string) error
}

type RepositoryUser

type RepositoryUser interface {
	Create(user User) (newUser User, err error)
	Delete(id uint64) (success bool, err error)
	GetByEmail(email string) (user User, err error)
	GetByUsername(username string) (user User, err error)
	Verify(user User) error
	SetPassword(user User, password string) error
}

type RepositoryVerifyAccount

type RepositoryVerifyAccount interface {
	Create(token string, userId uint64) (verification VerifyAccount, err error)
	Verify(token string) (verification VerifyAccount, err error)
}

type Session

type Session struct {
	ID   string
	User User
}

type Setup

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

func NewSetup

func NewSetup(ctx context.Context, logger *slog.Logger) Setup

type User

type User struct {
	ID       uint64
	Email    string
	Username string
	Password string
	Role     string
	Verified bool
	Payload  map[string]any
}

type VerifyAccount

type VerifyAccount struct {
	ID     uint64
	Token  string
	UserID uint64
}

Jump to

Keyboard shortcuts

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