Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrRecordNotFound = errors.New("record not found")
)
Define a custom ErrRecordNotFound error.
Functions ¶
This section is empty.
Types ¶
type CurrencyModel ¶
Define a CurrencyModel struct type which wraps a sql.DB connection pool.
func (CurrencyModel) Convert ¶
func (c CurrencyModel) Convert(base string, currencies []*Currency) []*Currency
func (CurrencyModel) Get ¶
func (c CurrencyModel) Get(id int64) (*Currency, error)
Get for fetching currency with the given id from the database.
func (CurrencyModel) GetRates ¶
GetRates method returns a slice of rates available in the database and date for which they are relevant. Rates can be filtered by date and ISO codes. The date of the rates may be different than requested one, because rates are not available e.g for holidays, weekends, etc. If that is the case then this method will return rates for the date that is the closest date in the past to the requested one.
func (*CurrencyModel) Insert ¶
func (c *CurrencyModel) Insert(currency *Currency) error
Insert for inserting new currency into the database.
Click to show internal directories.
Click to hide internal directories.