balance

package
v0.0.0-...-fa32389 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balance

type Balance struct {
	ID uuid.UUID `json:"id"`
	// EntityID is the ID of the entity that owns this balance
	EntityID uuid.UUID `json:"entity_id"`
	// TotalAmount is the total amount of money in this balance
	TotalAmount float64 `json:"total_amount"`
	// AvailableAmount is the amount of money that is available for use
	AvailableAmount float64   `json:"available_amount"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

func New

func New(entityID uuid.UUID, totalAmount float64) (*Balance, error)

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

func (_m *MockRepository) CreateBalance(ctx context.Context, _a1 *Balance, opts ...unitofwork.Option) error

CreateBalance provides a mock function with given fields: ctx, _a1, opts

func (*MockRepository) GetBalance

func (_m *MockRepository) GetBalance(ctx context.Context, entityID uuid.UUID, opts ...unitofwork.Option) (*Balance, error)

GetBalance provides a mock function with given fields: ctx, entityID, opts

func (*MockRepository) UpdateBalance

func (_m *MockRepository) UpdateBalance(ctx context.Context, _a1 *Balance, opts ...unitofwork.Option) error

UpdateBalance provides a mock function with given fields: ctx, _a1, opts

type Repository

type Repository interface {
	CreateBalance(ctx context.Context, balance *Balance, opts ...unitofwork.Option) error
	GetBalance(ctx context.Context, entityID uuid.UUID, opts ...unitofwork.Option) (*Balance, error)
	UpdateBalance(ctx context.Context, balance *Balance, opts ...unitofwork.Option) error
}

Jump to

Keyboard shortcuts

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