aboutsummaryrefslogtreecommitdiff
path: root/pkg/database
diff options
context:
space:
mode:
authorJulien Dessaux2021-09-10 17:26:23 +0200
committerJulien Dessaux2021-09-10 17:26:23 +0200
commit678fdf8759a7a6ed6628194d085a47b5490e68ea (patch)
treea335a5db442ad8ba2cc780c5ca17250a68d4f8f1 /pkg/database
parentAdded database function to get all train stops (diff)
downloadtrains-678fdf8759a7a6ed6628194d085a47b5490e68ea.tar.gz
trains-678fdf8759a7a6ed6628194d085a47b5490e68ea.tar.bz2
trains-678fdf8759a7a6ed6628194d085a47b5490e68ea.zip
Finished not so simple refactoring
Diffstat (limited to '')
-rw-r--r--pkg/database/stop.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/database/stop.go b/pkg/database/stop.go
index 0c2547c..8315c6d 100644
--- a/pkg/database/stop.go
+++ b/pkg/database/stop.go
@@ -45,7 +45,7 @@ func (env *DBEnv) GetStops() (stops []model.Stop, err error) {
return
}
-func (env *DBEnv) ReplaceAndImportStops(trainStops []model.Stop) error {
+func (env *DBEnv) ReplaceAndImportStops(stops []model.Stop) error {
pre_query := `DELETE FROM stops;`
query := `
INSERT INTO stops
@@ -61,11 +61,11 @@ func (env *DBEnv) ReplaceAndImportStops(trainStops []model.Stop) error {
tx.Rollback()
return newQueryError("Could not run database query: most likely the schema is corrupted", err)
}
- for i := 0; i < len(trainStops); i++ {
+ for i := 0; i < len(stops); i++ {
_, err = tx.Exec(
query,
- trainStops[i].Id,
- trainStops[i].Name,
+ stops[i].Id,
+ stops[i].Name,
)
if err != nil {
tx.Rollback()