services

package
v0.0.0-...-0f031a4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTaskDeleted  = errors.New("task was deleted")
	ErrTaskNotFound = errors.New("task not found")
)
View Source
var (
	ErrUserDeleted  = errors.New("user was deleted")
	ErrUserExist    = errors.New("email or username already in-use")
	ErrUserNotFound = errors.New("user not found")
)
View Source
var ErrPersonalAccessTokenNotFound = errors.New("personal access token not found")

Functions

func NewError

func NewError(err error, code Kind, message string) error

NewError instantiates a new error.

Types

type Error

type Error struct {
	Internal error
	Kind     Kind
	Message  string
}

Error represents an error that could be wrapping another error.

func (*Error) Error

func (e *Error) Error() string

Error returns the message, when wrapping errors the wrapped error is appended.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the wrapped error, if any.

type Kind

type Kind uint8

Kind defines supported error types.

const (
	Other    Kind = iota + 1 // Unclassified error.
	Exist                    // Item already exist.
	NotExist                 // Item does not exist.
	Deleted                  // Item was deleted.
	Conflict
	Permission
)

func (Kind) String

func (k Kind) String() string

type MockPersonalAccessTokenMapper

type MockPersonalAccessTokenMapper struct {
	mock.Mock
}

MockPersonalAccessTokenMapper is an autogenerated mock type for the PersonalAccessTokenMapper type

func NewMockPersonalAccessTokenMapper

func NewMockPersonalAccessTokenMapper(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockPersonalAccessTokenMapper

NewMockPersonalAccessTokenMapper creates a new instance of MockPersonalAccessTokenMapper. 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 (*MockPersonalAccessTokenMapper) Create

Create provides a mock function with given fields: ctx, model

func (*MockPersonalAccessTokenMapper) EXPECT

func (*MockPersonalAccessTokenMapper) Find

func (_m *MockPersonalAccessTokenMapper) Find(ctx context.Context, filter interface{}) (models.PersonalAccessTokens, error)

Find provides a mock function with given fields: ctx, filter

func (*MockPersonalAccessTokenMapper) FindOne

func (_m *MockPersonalAccessTokenMapper) FindOne(ctx context.Context, filter interface{}) (*models.PersonalAccessToken, error)

FindOne provides a mock function with given fields: ctx, filter

func (*MockPersonalAccessTokenMapper) Update

Update provides a mock function with given fields: ctx, model

type MockPersonalAccessTokenMapper_Create_Call

type MockPersonalAccessTokenMapper_Create_Call struct {
	*mock.Call
}

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

func (*MockPersonalAccessTokenMapper_Create_Call) Return

func (*MockPersonalAccessTokenMapper_Create_Call) Run

type MockPersonalAccessTokenMapper_Expecter

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

func (*MockPersonalAccessTokenMapper_Expecter) Create

func (_e *MockPersonalAccessTokenMapper_Expecter) Create(ctx interface{}, model interface{}) *MockPersonalAccessTokenMapper_Create_Call

Create is a helper method to define mock.On call

  • ctx context.Context
  • model *models.PersonalAccessToken

func (*MockPersonalAccessTokenMapper_Expecter) Find

func (_e *MockPersonalAccessTokenMapper_Expecter) Find(ctx interface{}, filter interface{}) *MockPersonalAccessTokenMapper_Find_Call

Find is a helper method to define mock.On call

  • ctx context.Context
  • filter interface{}

func (*MockPersonalAccessTokenMapper_Expecter) FindOne

func (_e *MockPersonalAccessTokenMapper_Expecter) FindOne(ctx interface{}, filter interface{}) *MockPersonalAccessTokenMapper_FindOne_Call

FindOne is a helper method to define mock.On call

  • ctx context.Context
  • filter interface{}

func (*MockPersonalAccessTokenMapper_Expecter) Update

func (_e *MockPersonalAccessTokenMapper_Expecter) Update(ctx interface{}, model interface{}) *MockPersonalAccessTokenMapper_Update_Call

Update is a helper method to define mock.On call

  • ctx context.Context
  • model *models.PersonalAccessToken

type MockPersonalAccessTokenMapper_FindOne_Call

type MockPersonalAccessTokenMapper_FindOne_Call struct {
	*mock.Call
}

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

func (*MockPersonalAccessTokenMapper_FindOne_Call) Return

func (*MockPersonalAccessTokenMapper_FindOne_Call) Run

func (*MockPersonalAccessTokenMapper_FindOne_Call) RunAndReturn

type MockPersonalAccessTokenMapper_Find_Call

type MockPersonalAccessTokenMapper_Find_Call struct {
	*mock.Call
}

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

func (*MockPersonalAccessTokenMapper_Find_Call) Return

func (*MockPersonalAccessTokenMapper_Find_Call) Run

func (*MockPersonalAccessTokenMapper_Find_Call) RunAndReturn

type MockPersonalAccessTokenMapper_Update_Call

type MockPersonalAccessTokenMapper_Update_Call struct {
	*mock.Call
}

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

func (*MockPersonalAccessTokenMapper_Update_Call) Return

func (*MockPersonalAccessTokenMapper_Update_Call) Run

type MockTaskMapper

type MockTaskMapper struct {
	mock.Mock
}

MockTaskMapper is an autogenerated mock type for the TaskMapper type

func NewMockTaskMapper

func NewMockTaskMapper(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockTaskMapper

NewMockTaskMapper creates a new instance of MockTaskMapper. 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 (*MockTaskMapper) Create

func (_m *MockTaskMapper) Create(ctx context.Context, model *models.Task) (*models.Task, error)

Create provides a mock function with given fields: ctx, model

func (*MockTaskMapper) EXPECT

func (*MockTaskMapper) Find

func (_m *MockTaskMapper) Find(ctx context.Context, filter interface{}, limit int, skip int) (int64, models.Tasks, error)

Find provides a mock function with given fields: ctx, filter, limit, skip

func (*MockTaskMapper) FindOneById

func (_m *MockTaskMapper) FindOneById(ctx context.Context, id string) (*models.Task, error)

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

func (*MockTaskMapper) Update

func (_m *MockTaskMapper) Update(ctx context.Context, model *models.Task) (*models.Task, error)

Update provides a mock function with given fields: ctx, model

type MockTaskMapper_Create_Call

type MockTaskMapper_Create_Call struct {
	*mock.Call
}

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

func (*MockTaskMapper_Create_Call) Return

func (*MockTaskMapper_Create_Call) Run

func (*MockTaskMapper_Create_Call) RunAndReturn

type MockTaskMapper_Expecter

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

func (*MockTaskMapper_Expecter) Create

func (_e *MockTaskMapper_Expecter) Create(ctx interface{}, model interface{}) *MockTaskMapper_Create_Call

Create is a helper method to define mock.On call

  • ctx context.Context
  • model *models.Task

func (*MockTaskMapper_Expecter) Find

func (_e *MockTaskMapper_Expecter) Find(ctx interface{}, filter interface{}, limit interface{}, skip interface{}) *MockTaskMapper_Find_Call

Find is a helper method to define mock.On call

  • ctx context.Context
  • filter interface{}
  • limit int
  • skip int

func (*MockTaskMapper_Expecter) FindOneById

func (_e *MockTaskMapper_Expecter) FindOneById(ctx interface{}, id interface{}) *MockTaskMapper_FindOneById_Call

FindOneById is a helper method to define mock.On call

  • ctx context.Context
  • id string

func (*MockTaskMapper_Expecter) Update

func (_e *MockTaskMapper_Expecter) Update(ctx interface{}, model interface{}) *MockTaskMapper_Update_Call

Update is a helper method to define mock.On call

  • ctx context.Context
  • model *models.Task

type MockTaskMapper_FindOneById_Call

type MockTaskMapper_FindOneById_Call struct {
	*mock.Call
}

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

func (*MockTaskMapper_FindOneById_Call) Return

func (*MockTaskMapper_FindOneById_Call) Run

func (*MockTaskMapper_FindOneById_Call) RunAndReturn

type MockTaskMapper_Find_Call

type MockTaskMapper_Find_Call struct {
	*mock.Call
}

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

func (*MockTaskMapper_Find_Call) Return

func (*MockTaskMapper_Find_Call) Run

func (_c *MockTaskMapper_Find_Call) Run(run func(ctx context.Context, filter interface{}, limit int, skip int)) *MockTaskMapper_Find_Call

func (*MockTaskMapper_Find_Call) RunAndReturn

func (_c *MockTaskMapper_Find_Call) RunAndReturn(run func(context.Context, interface{}, int, int) (int64, models.Tasks, error)) *MockTaskMapper_Find_Call

type MockTaskMapper_Update_Call

type MockTaskMapper_Update_Call struct {
	*mock.Call
}

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

func (*MockTaskMapper_Update_Call) Return

func (*MockTaskMapper_Update_Call) Run

func (*MockTaskMapper_Update_Call) RunAndReturn

type MockUserMapper

type MockUserMapper struct {
	mock.Mock
}

MockUserMapper is an autogenerated mock type for the UserMapper type

func NewMockUserMapper

func NewMockUserMapper(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockUserMapper

NewMockUserMapper creates a new instance of MockUserMapper. 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 (*MockUserMapper) Create

func (_m *MockUserMapper) Create(ctx context.Context, model *models.User) (*models.User, error)

Create provides a mock function with given fields: ctx, model

func (*MockUserMapper) EXPECT

func (*MockUserMapper) Find

func (_m *MockUserMapper) Find(ctx context.Context, filter interface{}, limit int, skip int) (int64, models.Users, error)

Find provides a mock function with given fields: ctx, filter, limit, skip

func (*MockUserMapper) FindOne

func (_m *MockUserMapper) FindOne(ctx context.Context, filter interface{}) (*models.User, error)

FindOne provides a mock function with given fields: ctx, filter

func (*MockUserMapper) Update

func (_m *MockUserMapper) Update(ctx context.Context, model *models.User) (*models.User, error)

Update provides a mock function with given fields: ctx, model

type MockUserMapper_Create_Call

type MockUserMapper_Create_Call struct {
	*mock.Call
}

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

func (*MockUserMapper_Create_Call) Return

func (*MockUserMapper_Create_Call) Run

func (*MockUserMapper_Create_Call) RunAndReturn

type MockUserMapper_Expecter

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

func (*MockUserMapper_Expecter) Create

func (_e *MockUserMapper_Expecter) Create(ctx interface{}, model interface{}) *MockUserMapper_Create_Call

Create is a helper method to define mock.On call

  • ctx context.Context
  • model *models.User

func (*MockUserMapper_Expecter) Find

func (_e *MockUserMapper_Expecter) Find(ctx interface{}, filter interface{}, limit interface{}, skip interface{}) *MockUserMapper_Find_Call

Find is a helper method to define mock.On call

  • ctx context.Context
  • filter interface{}
  • limit int
  • skip int

func (*MockUserMapper_Expecter) FindOne

func (_e *MockUserMapper_Expecter) FindOne(ctx interface{}, filter interface{}) *MockUserMapper_FindOne_Call

FindOne is a helper method to define mock.On call

  • ctx context.Context
  • filter interface{}

func (*MockUserMapper_Expecter) Update

func (_e *MockUserMapper_Expecter) Update(ctx interface{}, model interface{}) *MockUserMapper_Update_Call

Update is a helper method to define mock.On call

  • ctx context.Context
  • model *models.User

type MockUserMapper_FindOne_Call

type MockUserMapper_FindOne_Call struct {
	*mock.Call
}

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

func (*MockUserMapper_FindOne_Call) Return

func (*MockUserMapper_FindOne_Call) Run

func (_c *MockUserMapper_FindOne_Call) Run(run func(ctx context.Context, filter interface{})) *MockUserMapper_FindOne_Call

func (*MockUserMapper_FindOne_Call) RunAndReturn

func (_c *MockUserMapper_FindOne_Call) RunAndReturn(run func(context.Context, interface{}) (*models.User, error)) *MockUserMapper_FindOne_Call

type MockUserMapper_Find_Call

type MockUserMapper_Find_Call struct {
	*mock.Call
}

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

func (*MockUserMapper_Find_Call) Return

func (*MockUserMapper_Find_Call) Run

func (_c *MockUserMapper_Find_Call) Run(run func(ctx context.Context, filter interface{}, limit int, skip int)) *MockUserMapper_Find_Call

func (*MockUserMapper_Find_Call) RunAndReturn

func (_c *MockUserMapper_Find_Call) RunAndReturn(run func(context.Context, interface{}, int, int) (int64, models.Users, error)) *MockUserMapper_Find_Call

type MockUserMapper_Update_Call

type MockUserMapper_Update_Call struct {
	*mock.Call
}

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

func (*MockUserMapper_Update_Call) Return

func (*MockUserMapper_Update_Call) Run

func (*MockUserMapper_Update_Call) RunAndReturn

type PersonalAccessToken

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

PersonalAccessToken defines the application service in charge of interacting with Users.

func NewPersonalAccessToken

func NewPersonalAccessToken(mapper PersonalAccessTokenMapper) *PersonalAccessToken

func (*PersonalAccessToken) Create

func (*PersonalAccessToken) Find

func (*PersonalAccessToken) FindOne

func (t *PersonalAccessToken) FindOne(ctx context.Context, userId string, name string) (*models.PersonalAccessToken, error)

func (*PersonalAccessToken) Read

func (*PersonalAccessToken) Revoke

type PersonalAccessTokenMapper

type PersonalAccessTokenMapper interface {
	Create(ctx context.Context, model *models.PersonalAccessToken) (*models.PersonalAccessToken, error)
	Find(ctx context.Context, filter any) (models.PersonalAccessTokens, error)
	FindOne(ctx context.Context, filter any) (*models.PersonalAccessToken, error)
	Update(ctx context.Context, model *models.PersonalAccessToken) (*models.PersonalAccessToken, error)
}

PersonalAccessTokenMapper defines the datastore handling persisting User documents.

type Task

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

Task defines the application service in charge of interacting with Tasks.

func NewTask

func NewTask(mapper TaskMapper) *Task

func (*Task) Create

func (t *Task) Create(ctx context.Context, id string, model *models.Task) (*models.Task, error)

func (*Task) Delete

func (t *Task) Delete(ctx context.Context, id string, model *models.Task) error

func (*Task) Find

func (t *Task) Find(ctx context.Context, params *models.TaskSearchParams) (int64, models.Tasks, error)

func (*Task) Read

func (t *Task) Read(ctx context.Context, id string) (*models.Task, error)

func (*Task) Update

func (t *Task) Update(ctx context.Context, id string, model *models.Task) (*models.Task, error)

type TaskMapper

type TaskMapper interface {
	Create(ctx context.Context, model *models.Task) (*models.Task, error)
	Find(ctx context.Context, filter any, limit int, skip int) (int64, models.Tasks, error)
	FindOneById(ctx context.Context, id string) (*models.Task, error)
	Update(ctx context.Context, model *models.Task) (*models.Task, error)
}

TaskMapper defines the datastore handling persisting Task documents.

type User

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

User defines the application service in charge of interacting with Users.

func NewUser

func NewUser(mapper UserMapper) *User

func (*User) Create

func (u *User) Create(ctx context.Context, model *models.User) (*models.User, error)

func (*User) Delete

func (u *User) Delete(ctx context.Context, id string, model *models.User) error

func (*User) Find

func (u *User) Find(ctx context.Context, params *models.UserSearchParams) (int64, models.Users, error)

func (*User) FindOneByEmailOrUsername

func (u *User) FindOneByEmailOrUsername(ctx context.Context, email string, username string) (*models.User, error)

func (*User) Read

func (u *User) Read(ctx context.Context, id string) (*models.User, error)

func (*User) Update

func (u *User) Update(ctx context.Context, id string, model *models.User) (*models.User, error)

type UserMapper

type UserMapper interface {
	Create(ctx context.Context, model *models.User) (*models.User, error)
	Find(ctx context.Context, filter any, limit int, skip int) (int64, models.Users, error)
	FindOne(ctx context.Context, filter any) (*models.User, error)
	Update(ctx context.Context, model *models.User) (*models.User, error)
}

UserMapper defines the datastore handling persisting User documents.

Jump to

Keyboard shortcuts

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