mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
Changed the initialization of the countries
slice
This commit is contained in:
parent
054a4809dd
commit
70372e58ab
1 changed files with 5 additions and 3 deletions
|
@ -329,15 +329,17 @@ func (r *MoneroRepo) NetFees() []NetFee {
|
||||||
return netFees
|
return netFees
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Countries represents list of countries
|
||||||
type Countries struct {
|
type Countries struct {
|
||||||
TotalNodes int `json:"total_nodes" db:"total_nodes"`
|
TotalNodes int `json:"total_nodes" db:"total_nodes"`
|
||||||
CC string `json:"cc" db:"country"` // country code
|
CC string `json:"cc" db:"country"` // country code
|
||||||
Name string `json:"name" db:"country_name"`
|
Name string `json:"name" db:"country_name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get list of countries (count by nodes)
|
||||||
func (r *MoneroRepo) Countries() ([]Countries, error) {
|
func (r *MoneroRepo) Countries() ([]Countries, error) {
|
||||||
countries := []Countries{}
|
var c []Countries
|
||||||
err := r.db.Select(&countries, `
|
err := r.db.Select(&c, `
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(id) AS total_nodes,
|
COUNT(id) AS total_nodes,
|
||||||
country,
|
country,
|
||||||
|
@ -348,5 +350,5 @@ func (r *MoneroRepo) Countries() ([]Countries, error) {
|
||||||
country
|
country
|
||||||
ORDER BY
|
ORDER BY
|
||||||
country ASC`)
|
country ASC`)
|
||||||
return countries, err
|
return c, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue