Documentation
¶
Index ¶
- Variables
- type CreateReq
- type Currency
- type ExchangeRateReq
- type ListCurrenciesResult
- type Query
- type Service
- func (s *Service) CreateCurrency(ctx context.Context, in *CreateReq) (*Currency, error)
- func (s *Service) GetCurrencyByCode(ctx context.Context, code string) (*Currency, error)
- func (s *Service) GetCurrencyByID(ctx context.Context, id string) (*Currency, error)
- func (s *Service) ListCurrencies(ctx context.Context, in *Query) (*ListCurrenciesResult, error)
- func (s *Service) UpdateExchangeRate(ctx context.Context, in *ExchangeRateReq) (*Currency, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCurrencyNotFound = errors.New("currency not found")
ErrCurrencyNotFound is returned when a currency is not found in the database.
Functions ¶
This section is empty.
Types ¶
type CreateReq ¶
type CreateReq struct {
Code string `json:"code"`
ExchangeRate decimal.Decimal `json:"exchangeRate"`
}
CreateReq represents a request for creating a currency.
type Currency ¶
type Currency struct {
ID string `json:"id"`
Code string `json:"code"`
ExchangeRate decimal.Decimal `json:"exchangeRate"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
// contains filtered or unexported fields
}
Currency represents a currency and its exchange rate. The Code is the ISO 4217 currency code.
Base currency is LAK.
type ExchangeRateReq ¶
type ExchangeRateReq struct {
ID string `param:"id"`
ExchangeRate decimal.Decimal `json:"exchangeRate"`
}
ExchangeRateReq represents a request to update an exchange rate.
func (*ExchangeRateReq) Validate ¶
func (r *ExchangeRateReq) Validate() error
type ListCurrenciesResult ¶
type Query ¶
type Query struct {
ID string `json:"id" param:"id" query:"id"`
Code string `json:"code" query:"code"`
PageToken string `json:"pageToken" query:"pageToken"`
PageSize uint64 `json:"pageSize" query:"pageSize"`
CreatedAfter time.Time `json:"createdAfter" query:"createdAfter"`
CreatedBefore time.Time `json:"createdBefore" query:"createdBefore"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CreateCurrency ¶
func (*Service) GetCurrencyByCode ¶
func (*Service) GetCurrencyByID ¶
func (*Service) ListCurrencies ¶
func (*Service) UpdateExchangeRate ¶
Click to show internal directories.
Click to hide internal directories.