forked from OrgGo/Tasks
formatting small things
This commit is contained in:
parent
eb42e38fae
commit
534cb71064
10
db/tasks.go
10
db/tasks.go
|
@ -2,13 +2,12 @@ package db
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3" //we want to use sqlite natively
|
||||
md "github.com/shurcooL/github_flavored_markdown"
|
||||
"github.com/thewhitetulip/Tasks/types"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var database Database
|
||||
|
@ -162,6 +161,7 @@ func UpdateTask(id int, title string, content string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
//taskQuery encapsulates running multiple queries which don't do much things
|
||||
func taskQuery(sql string, args ...interface{}) error {
|
||||
SQL := database.prepare(sql)
|
||||
tx := database.begin()
|
||||
|
@ -170,7 +170,7 @@ func taskQuery(sql string, args ...interface{}) error {
|
|||
log.Println(err)
|
||||
tx.Rollback()
|
||||
} else {
|
||||
log.Println(tx.Commit())
|
||||
tx.Commit()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
package views
|
||||
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"log"
|
||||
"strconv"
|
||||
"os"
|
||||
"time"
|
||||
"fmt"
|
||||
"text/template"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"github.com/thewhitetulip/Tasks/db"
|
||||
"io"
|
||||
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"text/template"
|
||||
"time"
|
||||
)
|
||||
|
||||
// UploadedFileHandler is used to handle the uploaded file related requests
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
|
||||
//TrashTaskFunc is used to populate the trash tasks
|
||||
func TrashTaskFunc(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
|
@ -50,7 +49,6 @@ func RestoreTaskFunc(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//EditTaskFunc is used to edit tasks, handles "/edit/" URL
|
||||
func EditTaskFunc(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
|
@ -67,7 +65,6 @@ func EditTaskFunc(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//DeleteTaskFunc is used to delete a task, trash = move to recycle bin, delete = permanent delete
|
||||
func DeleteTaskFunc(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
|
@ -95,7 +92,6 @@ func DeleteTaskFunc(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//RestoreFromCompleteFunc restores the task from complete to pending
|
||||
func RestoreFromCompleteFunc(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "GET" {
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"text/template"
|
||||
)
|
||||
|
||||
|
||||
//PopulateTemplates is used to parse all templates present in
|
||||
//the templates folder
|
||||
func PopulateTemplates() {
|
||||
|
@ -81,7 +80,6 @@ func SearchTaskFunc(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//UpdateTaskFunc is used to update a task, handes "/update/" URL
|
||||
func UpdateTaskFunc(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Method == "POST" {
|
||||
|
|
Loading…
Reference in New Issue