This repository has been archived on 2024-05-18. You can view files and clone it, but cannot push or open issues or pull requests.
steamServer/postgres/region_store.go

21 lines
447 B
Go
Raw Normal View History

2021-09-20 22:55:12 +02:00
package postgres
import (
"fmt"
"git.snrd.de/Spaenny/steamServer"
"github.com/jmoiron/sqlx"
)
type RegionStore struct {
*sqlx.DB
}
func (s *RegionStore) Region(name string) (steamServer.Region, error) {
var r steamServer.Region
if err := s.Get(&r, `SELECT * FROM regions WHERE name = $1`, name); err != nil {
return steamServer.Region{}, fmt.Errorf("error getting region id: %w", err)
}
return r, nil
}