From 25ddc9ec6e579b549b2683bceb7b05e47cb9e954 Mon Sep 17 00:00:00 2001 From: Adhatama Date: Tue, 3 Apr 2018 10:44:41 +0700 Subject: [PATCH] Fix wrong spelling in tania persistence engine --- conf.json.example | 2 +- config/config.go | 2 +- main.go | 6 ++--- src/assets/server/farm_server.go | 2 +- src/growth/server/growth_server.go | 2 +- src/tasks/server/task_server.go | 40 +++++++++++++++--------------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/conf.json.example b/conf.json.example index 81b3b0af..275f68af 100644 --- a/conf.json.example +++ b/conf.json.example @@ -1,5 +1,5 @@ { - "tania_persistance_engine": "sqlite", + "tania_persistence_engine": "sqlite", "demo_mode": true, "upload_path_area": "/Users/user/Code/golang/src/github.com/Tanibox/tania-server/uploads/areas", "upload_path_crop": "/Users/user/Code/golang/src/github.com/Tanibox/tania-server/uploads/crops", diff --git a/config/config.go b/config/config.go index 47480f2b..358e7230 100644 --- a/config/config.go +++ b/config/config.go @@ -12,7 +12,7 @@ type Configuration struct { DemoMode *bool UploadPathArea *string UploadPathCrop *string - TaniaPersistanceEngine *string + TaniaPersistenceEngine *string SqlitePath *string MysqlHost *string MysqlPort *string diff --git a/main.go b/main.go index 6c8a487e..da60abf4 100644 --- a/main.go +++ b/main.go @@ -38,13 +38,13 @@ func main() { e := echo.New() // Initialize DB. - log.Print("Using " + *config.Config.TaniaPersistanceEngine + " persistance engine") + log.Print("Using " + *config.Config.TaniaPersistenceEngine + " persistance engine") // InMemory DB will always be initialized. inMem := initInMemory() var db *sql.DB - switch *config.Config.TaniaPersistanceEngine { + switch *config.Config.TaniaPersistenceEngine { case config.DB_SQLITE: db = initSqlite() case config.DB_MYSQL: @@ -191,7 +191,7 @@ func initConfig() { UploadPathArea: conf.String("upload_path_area", "tania-uploads/area", "Upload path for the Area photo"), UploadPathCrop: conf.String("upload_path_crop", "tania-uploads/crop", "Upload path for the Crop photo"), DemoMode: conf.Bool("demo_mode", true, "Switch for the demo mode"), - TaniaPersistanceEngine: conf.String("tania_persistance_engine", "sqlite", "The persistance engine of Tania. Options are inmemory, sqlite, inmemory"), + TaniaPersistenceEngine: conf.String("tania_persistence_engine", "sqlite", "The persistance engine of Tania. Options are inmemory, sqlite, inmemory"), SqlitePath: conf.String("sqlite_path", "tania.db", "Path of sqlite file db"), MysqlHost: conf.String("mysql_host", "127.0.0.1", "Mysql Host"), MysqlPort: conf.String("mysql_port", "3306", "Mysql Port"), diff --git a/src/assets/server/farm_server.go b/src/assets/server/farm_server.go index f33e5bc2..ec3806d3 100644 --- a/src/assets/server/farm_server.go +++ b/src/assets/server/farm_server.go @@ -73,7 +73,7 @@ func NewFarmServer( EventBus: eventBus, } - switch *config.Config.TaniaPersistanceEngine { + switch *config.Config.TaniaPersistenceEngine { case config.DB_INMEMORY: farmServer.FarmEventRepo = repoInMem.NewFarmEventRepositoryInMemory(farmEventStorage) farmServer.FarmEventQuery = queryInMem.NewFarmEventQueryInMemory(farmEventStorage) diff --git a/src/growth/server/growth_server.go b/src/growth/server/growth_server.go index 539333d9..cd59d2b8 100644 --- a/src/growth/server/growth_server.go +++ b/src/growth/server/growth_server.go @@ -64,7 +64,7 @@ func NewGrowthServer( EventBus: bus, } - switch *config.Config.TaniaPersistanceEngine { + switch *config.Config.TaniaPersistenceEngine { case config.DB_INMEMORY: growthServer.CropEventRepo = repoInMem.NewCropEventRepositoryInMemory(cropEventStorage) growthServer.CropEventQuery = queryInMem.NewCropEventQueryInMemory(cropEventStorage) diff --git a/src/tasks/server/task_server.go b/src/tasks/server/task_server.go index b12fcd38..4b855dde 100644 --- a/src/tasks/server/task_server.go +++ b/src/tasks/server/task_server.go @@ -51,7 +51,7 @@ func NewTaskServer( EventBus: bus, } - switch *config.Config.TaniaPersistanceEngine { + switch *config.Config.TaniaPersistenceEngine { case config.DB_INMEMORY: taskServer.TaskEventRepo = repoInMem.NewTaskEventRepositoryInMemory(taskEventStorage) taskServer.TaskReadRepo = repoInMem.NewTaskReadRepositoryInMemory(taskReadStorage) @@ -175,16 +175,16 @@ func (s TaskServer) FindAllTasks(c echo.Context) error { // Return list of tasks data["data"] = taskList // Return number of tasks - countResult := <-s.TaskReadQuery.CountAll() - - if countResult.Error != nil { - return countResult.Error - } - count, ok := countResult.Result.(int) - if !ok { - return echo.NewHTTPError(http.StatusBadRequest, "Internal server error") - } - data["total_rows"] = count + countResult := <-s.TaskReadQuery.CountAll() + + if countResult.Error != nil { + return countResult.Error + } + count, ok := countResult.Result.(int) + if !ok { + return echo.NewHTTPError(http.StatusBadRequest, "Internal server error") + } + data["total_rows"] = count data["page"] = pageInt return c.JSON(http.StatusOK, data) @@ -231,15 +231,15 @@ func (s TaskServer) FindFilteredTasks(c echo.Context) error { // Return list of tasks data["data"] = taskList // Return number of tasks - countResult := <-s.TaskReadQuery.CountTasksWithFilter(queryparams) - - if countResult.Error != nil { - return countResult.Error - } - count, ok := countResult.Result.(int) - if !ok { - return echo.NewHTTPError(http.StatusBadRequest, "Internal server error") - } + countResult := <-s.TaskReadQuery.CountTasksWithFilter(queryparams) + + if countResult.Error != nil { + return countResult.Error + } + count, ok := countResult.Result.(int) + if !ok { + return echo.NewHTTPError(http.StatusBadRequest, "Internal server error") + } data["total_rows"] = count data["page"] = pageInt return c.JSON(http.StatusOK, data)