|
|
|
@ -22,8 +22,8 @@ type AardMapper struct {
|
|
|
|
|
db *sql.DB
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (am AardMapper) Areas() ([]Area, error) {
|
|
|
|
|
areas := make([]Area, 0)
|
|
|
|
|
func (am AardMapper) Areas() (map[string]Area, error) {
|
|
|
|
|
areas := make(map[string]Area)
|
|
|
|
|
rows, err := am.db.Query("select uid, name, flags from areas;")
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
@ -33,7 +33,7 @@ func (am AardMapper) Areas() ([]Area, error) {
|
|
|
|
|
for rows.Next() {
|
|
|
|
|
var a Area
|
|
|
|
|
err := rows.Scan(&a.Uid, &a.Name, &a.Flags)
|
|
|
|
|
areas = append(areas, a)
|
|
|
|
|
areas[a.Uid] = a
|
|
|
|
|
if err != nil {
|
|
|
|
|
return areas, fmt.Errorf("error scanning area into struct: %s\n", err)
|
|
|
|
|
}
|
|
|
|
|