added region support, fixed minor bugs
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
4807355add
commit
77b88325cf
@ -0,0 +1,20 @@
|
||||
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
|
||||
}
|
Loading…
Reference in New Issue