adminservice

package
v0.0.0-...-a9081ec Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package adminservice holds the business logic and data structures associated with the admin domain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicOperation

type AtomicOperation func(context.Context, Repository) error

AtomicOperation is the format waited by AtomicRepository.

type AtomicRepository

type AtomicRepository interface {
	Execute(context.Context, AtomicOperation) error
}

AtomicRepository will execute the repository with Transaction.

type Config

type Config struct {
	AdminRepository AtomicRepository
	Tracer          trace.Tracer
	Logger          *otelzap.Logger
}

Config will hold repository and used utils that will be injected into this Service layer on service initialization.

type Interface

type Interface interface {
	Signin(ctx context.Context, u *ent.Admin) error
	Signup(ctx context.Context, u *ent.Admin) error

	ModifyProfile(ctx context.Context, u *ent.Admin) error
	GetAdmin(ctx context.Context, u *ent.Admin) error
}

Interface specifies the business operations of the service.

func New

func New(c *Config) Interface

New configures and returns an Interface implementation.

type MockAtomicOperation

type MockAtomicOperation struct {
	mock.Mock
}

MockAtomicOperation is an autogenerated mock type for the AtomicOperation type

func NewMockAtomicOperation

func NewMockAtomicOperation(t mockConstructorTestingTNewMockAtomicOperation) *MockAtomicOperation

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

func (*MockAtomicOperation) Execute

func (_m *MockAtomicOperation) Execute(_a0 context.Context, _a1 Repository) error

Execute provides a mock function with given fields: _a0, _a1

type MockAtomicRepository

type MockAtomicRepository struct {
	mock.Mock
}

MockAtomicRepository is an autogenerated mock type for the AtomicRepository type

func NewMockAtomicRepository

func NewMockAtomicRepository(t mockConstructorTestingTNewMockAtomicRepository) *MockAtomicRepository

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

func (*MockAtomicRepository) Execute

Execute provides a mock function with given fields: _a0, _a1

type MockInterface

type MockInterface struct {
	mock.Mock
}

MockInterface is an autogenerated mock type for the Interface type

func NewMockInterface

func NewMockInterface(t mockConstructorTestingTNewMockInterface) *MockInterface

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

func (*MockInterface) GetAdmin

func (_m *MockInterface) GetAdmin(ctx context.Context, u *ent.Admin) error

GetAdmin provides a mock function with given fields: ctx, u

func (*MockInterface) ModifyProfile

func (_m *MockInterface) ModifyProfile(ctx context.Context, u *ent.Admin) error

ModifyProfile provides a mock function with given fields: ctx, u

func (*MockInterface) Signin

func (_m *MockInterface) Signin(ctx context.Context, u *ent.Admin) error

Signin provides a mock function with given fields: ctx, u

func (*MockInterface) Signup

func (_m *MockInterface) Signup(ctx context.Context, u *ent.Admin) error

Signup provides a mock function with given fields: ctx, u

type MockRepository

type MockRepository struct {
	mock.Mock
}

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) CreateAdmin

func (_m *MockRepository) CreateAdmin(ctx context.Context, u *ent.Admin) error

CreateAdmin provides a mock function with given fields: ctx, u

func (*MockRepository) FindAdminByID

func (_m *MockRepository) FindAdminByID(ctx context.Context, uid uuid.UUID) (*ent.Admin, error)

FindAdminByID provides a mock function with given fields: ctx, uid

func (*MockRepository) FindAdminByLogin

func (_m *MockRepository) FindAdminByLogin(ctx context.Context, login string) (*ent.Admin, error)

FindAdminByLogin provides a mock function with given fields: ctx, login

func (*MockRepository) UpdateAdmin

func (_m *MockRepository) UpdateAdmin(ctx context.Context, u *ent.Admin) error

UpdateAdmin provides a mock function with given fields: ctx, u

type Repository

type Repository interface {
	CreateAdmin(ctx context.Context, u *ent.Admin) error
	UpdateAdmin(ctx context.Context, u *ent.Admin) error

	FindAdminByID(ctx context.Context, uid uuid.UUID) (*ent.Admin, error)
	FindAdminByLogin(ctx context.Context, login string) (*ent.Admin, error)
}

Repository contain all the function available in the defined domain.

Jump to

Keyboard shortcuts

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