currency

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 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 Entity added in v1.3.0

type Entity struct {
	registry.Entity
	Code     money.Code `json:"code"`
	Name     string     `json:"name"`
	Symbol   string     `json:"symbol"`
	Decimals int        `json:"decimals"`
	Country  string     `json:"country,omitempty"`
	Region   string     `json:"region,omitempty"`
	Active   bool       `json:"active"`
}

type Service

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

Service provides business logic for currency operations

func New added in v1.2.0

func New(
	registry registry.Provider,
	logger *slog.Logger,
) *Service

New creates a new currency service

func (*Service) Activate added in v1.3.0

func (s *Service) Activate(ctx context.Context, code string) error

Activate activates a currency

func (*Service) Deactivate added in v1.3.0

func (s *Service) Deactivate(ctx context.Context, code string) error

Deactivate deactivates a currency

func (*Service) Get added in v1.3.0

func (s *Service) Get(ctx context.Context, code string) (*money.Currency, error)

Get retrieves currency information by code

func (*Service) GetDefault added in v1.3.0

func (s *Service) GetDefault(
	ctx context.Context,
) (*money.Currency, error)

GetDefault returns the default currency information

func (*Service) GetStatistics added in v1.3.0

func (s *Service) GetStatistics(
	ctx context.Context,
) (map[string]any, error)

GetStatistics returns currency statistics

func (*Service) IsSupported added in v1.3.0

func (s *Service) IsSupported(ctx context.Context, code string) bool

IsSupported checks if a currency is both registered and active

func (*Service) ListAll added in v1.3.0

func (s *Service) ListAll(ctx context.Context) ([]*money.Currency, error)

ListAll returns all registered currencies with full metadata

func (*Service) ListSupported added in v1.3.0

func (s *Service) ListSupported(ctx context.Context) ([]string, error)

ListSupported returns all supported currency codes

func (*Service) Register added in v1.3.0

func (s *Service) Register(ctx context.Context, meta Entity) error

Register registers a new currency

func (*Service) Search added in v1.3.0

func (s *Service) Search(
	ctx context.Context,
	query string,
) ([]*money.Currency, error)

Search searches for currencies by name

func (*Service) SearchByRegion added in v1.3.0

func (s *Service) SearchByRegion(
	ctx context.Context,
	region string,
) ([]*money.Currency, error)

SearchByRegion searches for currencies by region

func (*Service) Unregister added in v1.3.0

func (s *Service) Unregister(ctx context.Context, code string) error

Unregister removes a currency from the registry

func (*Service) ValidateCode added in v1.3.0

func (s *Service) ValidateCode(
	ctx context.Context,
	code string,
) error

ValidateCode validates a currency code format

Jump to

Keyboard shortcuts

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