aboutsummaryrefslogtreecommitdiff
path: root/pkg/database/stop.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-08 15:23:50 +0200
committerJulien Dessaux2021-09-08 16:12:01 +0200
commit3c5e31b25a53268b413bc1e511b7486a2a1c80b9 (patch)
treef6fe9a82eab8abf7a01f84bce954edc7462f87a2 /pkg/database/stop.go
parentRemoved useless user model code (diff)
downloadtrains-3c5e31b25a53268b413bc1e511b7486a2a1c80b9.tar.gz
trains-3c5e31b25a53268b413bc1e511b7486a2a1c80b9.tar.bz2
trains-3c5e31b25a53268b413bc1e511b7486a2a1c80b9.zip
Renamed TrainStop to simply Stop
Diffstat (limited to '')
-rw-r--r--pkg/database/stop.go (renamed from pkg/database/train_stop.go)10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/database/train_stop.go b/pkg/database/stop.go
index ee7be00..519b9aa 100644
--- a/pkg/database/train_stop.go
+++ b/pkg/database/stop.go
@@ -4,8 +4,8 @@ import (
"git.adyxax.org/adyxax/trains/pkg/model"
)
-func (env *DBEnv) CountTrainStops() (i int, err error) {
- query := `SELECT count(*) from train_stops;`
+func (env *DBEnv) CountStops() (i int, err error) {
+ query := `SELECT count(*) from stops;`
err = env.db.QueryRow(query).Scan(&i)
if err != nil {
return 0, newQueryError("Could not run database query: most likely the schema is corrupted", err)
@@ -13,10 +13,10 @@ func (env *DBEnv) CountTrainStops() (i int, err error) {
return
}
-func (env *DBEnv) ReplaceAndImportTrainStops(trainStops []model.TrainStop) error {
- pre_query := `DELETE FROM train_stops;`
+func (env *DBEnv) ReplaceAndImportStops(trainStops []model.Stop) error {
+ pre_query := `DELETE FROM stops;`
query := `
- INSERT INTO train_stops
+ INSERT INTO stops
(id, name)
VALUES
($1, $2);`