studentservice

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: 11 Imported by: 0

Documentation

Overview

Package studentservice holds the business logic and data structures associated with the student 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 {
	StudentRepository 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 {
	GetStudent(ctx context.Context, u *ent.Student) error
	GetStudentsWithSearchWithPagination(ctx context.Context, u *ent.Students, us *ent.Student, pagination *pagination.Front) error
	GetStudentFromLogin(ctx context.Context, u *ent.Student) error
	GetStudentsWithPagination(ctx context.Context, u *ent.Students, pagination *pagination.Front) error

	ModifyProfile(ctx context.Context, u *ent.Student) error

	DeleteStudent(ctx context.Context, u *ent.Student) error

	Signup(ctx context.Context, u *ent.Student) error
	Signin(ctx context.Context, u *ent.Student) 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) DeleteStudent

func (_m *MockInterface) DeleteStudent(ctx context.Context, u *ent.Student) error

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

func (*MockInterface) GetStudent

func (_m *MockInterface) GetStudent(ctx context.Context, u *ent.Student) error

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

func (*MockInterface) GetStudentFromLogin

func (_m *MockInterface) GetStudentFromLogin(ctx context.Context, u *ent.Student) error

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

func (*MockInterface) GetStudentsWithPagination

func (_m *MockInterface) GetStudentsWithPagination(ctx context.Context, u *ent.Students, _a2 *pagination.Front) error

GetStudentsWithPagination provides a mock function with given fields: ctx, u, _a2

func (*MockInterface) GetStudentsWithSearchWithPagination

func (_m *MockInterface) GetStudentsWithSearchWithPagination(ctx context.Context, u *ent.Students, us *ent.Student, _a3 *pagination.Front) error

GetStudentsWithSearchWithPagination provides a mock function with given fields: ctx, u, us, _a3

func (*MockInterface) ModifyProfile

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

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

func (*MockInterface) Signin

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

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

func (*MockInterface) Signup

func (_m *MockInterface) Signup(ctx context.Context, u *ent.Student) 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) CheckStudentPseudo

func (_m *MockRepository) CheckStudentPseudo(ctx context.Context, u *ent.Student) (bool, error)

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

func (*MockRepository) CreateStudent

func (_m *MockRepository) CreateStudent(ctx context.Context, u *ent.Student) error

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

func (*MockRepository) DeleteStudent

func (_m *MockRepository) DeleteStudent(ctx context.Context, u *ent.Student) error

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

func (*MockRepository) FindStudentByID

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

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

func (*MockRepository) FindStudentByLogin

func (_m *MockRepository) FindStudentByLogin(ctx context.Context, login string) (*ent.Student, error)

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

func (*MockRepository) FindStudentsByLoginOrFirstNameOrLastNameAtOffset

func (_m *MockRepository) FindStudentsByLoginOrFirstNameOrLastNameAtOffset(ctx context.Context, stud *ent.Student, off int, limit int) (ent.Students, error)

FindStudentsByLoginOrFirstNameOrLastNameAtOffset provides a mock function with given fields: ctx, stud, off, limit

func (*MockRepository) GetAllStudentsAtOffset

func (_m *MockRepository) GetAllStudentsAtOffset(ctx context.Context, u *ent.Students, off int, limit int) error

GetAllStudentsAtOffset provides a mock function with given fields: ctx, u, off, limit

func (*MockRepository) GetTotalStudentByPseudoOrFirstNameOrLastNameCount

func (_m *MockRepository) GetTotalStudentByPseudoOrFirstNameOrLastNameCount(ctx context.Context, n *ent.Student) (int, error)

GetTotalStudentByPseudoOrFirstNameOrLastNameCount provides a mock function with given fields: ctx, n

func (*MockRepository) GetTotalStudentCount

func (_m *MockRepository) GetTotalStudentCount(ctx context.Context) (int, error)

GetTotalStudentCount provides a mock function with given fields: ctx

func (*MockRepository) UpdatePseudoUsernameAndPassword

func (_m *MockRepository) UpdatePseudoUsernameAndPassword(ctx context.Context, u *ent.Student) error

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

func (*MockRepository) UpdateStudent

func (_m *MockRepository) UpdateStudent(ctx context.Context, u *ent.Student) error

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

type Repository

type Repository interface {
	CreateStudent(ctx context.Context, u *ent.Student) error
	UpdateStudent(ctx context.Context, u *ent.Student) error
	UpdatePseudoUsernameAndPassword(ctx context.Context, u *ent.Student) error

	GetAllStudentsAtOffset(ctx context.Context, u *ent.Students, off int, limit int) error

	GetTotalStudentCount(ctx context.Context) (int, error)
	GetTotalStudentByPseudoOrFirstNameOrLastNameCount(ctx context.Context, n *ent.Student) (int, error)

	FindStudentByID(ctx context.Context, uid uuid.UUID) (*ent.Student, error)
	FindStudentByLogin(ctx context.Context, login string) (*ent.Student, error)
	FindStudentsByLoginOrFirstNameOrLastNameAtOffset(ctx context.Context, stud *ent.Student, off int, limit int) (ent.Students, error)

	CheckStudentPseudo(ctx context.Context, u *ent.Student) (bool, error)

	DeleteStudent(ctx context.Context, u *ent.Student) 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