Add CANT_FIND_CURRENCY error to db.go and fix problem when initCurrencies returned CANT_FIND_METRIC
This commit is contained in:
parent
282339e7af
commit
2566ec8eaa
5
db/db.go
5
db/db.go
|
@ -77,7 +77,8 @@ func Connect() *gorm.DB {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
CANT_FIND_METRIC = errors.New("Can't find proper metrics in database")
|
CANT_FIND_METRIC = errors.New("Can't find proper metrics in database")
|
||||||
|
CANT_FIND_CURRENCY = errors.New("Can't find proper currencies in database")
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkSeededValues[T Identifiable](whatToCheck []*T, errorIfNotFound error, tx *gorm.DB) error {
|
func checkSeededValues[T Identifiable](whatToCheck []*T, errorIfNotFound error, tx *gorm.DB) error {
|
||||||
|
@ -127,7 +128,7 @@ func initCurrencies(tx *gorm.DB) error {
|
||||||
{Name: "Kazakhstani Tenge", Symbol: "₸", ISOName: "KZT"},
|
{Name: "Kazakhstani Tenge", Symbol: "₸", ISOName: "KZT"},
|
||||||
{Name: "Chinese Yuan", Symbol: "¥", ISOName: "CNY"},
|
{Name: "Chinese Yuan", Symbol: "¥", ISOName: "CNY"},
|
||||||
}
|
}
|
||||||
return checkSeededValues(currsThatNeeded, CANT_FIND_METRIC, tx)
|
return checkSeededValues(currsThatNeeded, CANT_FIND_CURRENCY, tx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func initStateOfDb(tx *gorm.DB) error {
|
func initStateOfDb(tx *gorm.DB) error {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user