address

package
v0.0.0-...-f15602e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package address contains user address oriented logic.

Package address is a generated GoMock package.

Package address is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	ID     ID
	UserID user.ID

	Props *Props
}

Address represents the address.

type Addresses

type Addresses []*Address

Addresses slice of Address.

type Filter

type Filter struct {
	ID     IDFilter
	UserID user.IDFilter
}

Filter represents address filter.

type ID

type ID int64

ID represents an id for address.

type IDFilter

type IDFilter struct {
	Eq  IDs
	Neq IDs
}

IDFilter represents ID filter.

type IDs

type IDs []ID

IDs defines a slice of ID.

func (IDs) ToInt64

func (ids IDs) ToInt64() []int64

ToInt64 convert slice of IDs to slice int64.

type MockRepository

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

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) Create

func (m *MockRepository) Create(ctx context.Context, props *Props) (*Address, error)

Create mocks base method.

func (*MockRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockRepository) Get

func (m *MockRepository) Get(ctx context.Context, filter *Filter) (*Address, error)

Get mocks base method.

func (*MockRepository) Query

func (m *MockRepository) Query(ctx context.Context, criteria *QueryCriteria) (Addresses, error)

Query mocks base method.

type MockRepositoryMockRecorder

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

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) Create

func (mr *MockRepositoryMockRecorder) Create(ctx, props any) *gomock.Call

Create indicates an expected call of Create.

func (*MockRepositoryMockRecorder) Get

func (mr *MockRepositoryMockRecorder) Get(ctx, filter any) *gomock.Call

Get indicates an expected call of Get.

func (*MockRepositoryMockRecorder) Query

func (mr *MockRepositoryMockRecorder) Query(ctx, criteria any) *gomock.Call

Query indicates an expected call of Query.

type MockService

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

MockService is a mock of Service interface.

func NewMockService

func NewMockService(ctrl *gomock.Controller) *MockService

NewMockService creates a new mock instance.

func (*MockService) Create

func (m *MockService) Create(ctx context.Context, props *Props) (*Address, error)

Create mocks base method.

func (*MockService) EXPECT

func (m *MockService) EXPECT() *MockServiceMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockService) Get

func (m *MockService) Get(ctx context.Context, filter *Filter) (*Address, error)

Get mocks base method.

func (*MockService) Query

func (m *MockService) Query(ctx context.Context, criteria *QueryCriteria) (Addresses, error)

Query mocks base method.

type MockServiceMockRecorder

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

MockServiceMockRecorder is the mock recorder for MockService.

func (*MockServiceMockRecorder) Create

func (mr *MockServiceMockRecorder) Create(ctx, props any) *gomock.Call

Create indicates an expected call of Create.

func (*MockServiceMockRecorder) Get

func (mr *MockServiceMockRecorder) Get(ctx, filter any) *gomock.Call

Get indicates an expected call of Get.

func (*MockServiceMockRecorder) Query

func (mr *MockServiceMockRecorder) Query(ctx, criteria any) *gomock.Call

Query indicates an expected call of Query.

type Props

type Props struct {
	City     string
	Country  string
	Flat     *int
	House    int
	Letter   *string
	Postcode int
	Street   string
}

Props represents address editable fields.

type QueryCriteria

type QueryCriteria struct {
	Filter Filter
}

QueryCriteria represents a criteria for address query.

type Repository

type Repository interface {
	Get(ctx context.Context, filter *Filter) (*Address, error)
	Query(ctx context.Context, criteria *QueryCriteria) (Addresses, error)
	Create(ctx context.Context, props *Props) (*Address, error)
}

Repository represents address repository.

type Service

type Service interface {
	Get(ctx context.Context, filter *Filter) (*Address, error)
	Query(ctx context.Context, criteria *QueryCriteria) (Addresses, error)
	Create(ctx context.Context, props *Props) (*Address, error)
}

Service represents address use cases.

type UseCase

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

UseCase represents address service.

func NewUseCase

func NewUseCase(addressRepo Repository) *UseCase

NewUseCase create instance of UseCase.

func (UseCase) Create

func (s UseCase) Create(ctx context.Context, props *Props) (*Address, error)

Create address.

func (UseCase) Get

func (s UseCase) Get(ctx context.Context, filter *Filter) (*Address, error)

Get address.

func (UseCase) Query

func (s UseCase) Query(ctx context.Context, criteria *QueryCriteria) (Addresses, error)

Query addresses.

Directories

Path Synopsis
Package pg contains implementations for address repositories.
Package pg contains implementations for address repositories.

Jump to

Keyboard shortcuts

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