Skip to content

Commit

Permalink
Fix wrong spelling in tania persistence engine
Browse files Browse the repository at this point in the history
  • Loading branch information
adhatama committed Apr 3, 2018
1 parent 3a8d363 commit 25ddc9e
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion conf.json.example
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type Configuration struct {
DemoMode *bool
UploadPathArea *string
UploadPathCrop *string
TaniaPersistanceEngine *string
TaniaPersistenceEngine *string
SqlitePath *string
MysqlHost *string
MysqlPort *string
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"),
Expand Down
2 changes: 1 addition & 1 deletion src/assets/server/farm_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/growth/server/growth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
40 changes: 20 additions & 20 deletions src/tasks/server/task_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 25ddc9e

Please sign in to comment.