aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crypto/crypto.go (renamed from helper/crypto.go)4
-rw-r--r--duration/LICENSE (renamed from server/template/helper/LICENSE)0
-rw-r--r--duration/duration.go (renamed from server/template/helper/elapsed.go)6
-rw-r--r--duration/duration_test.go (renamed from server/template/helper/elapsed_test.go)4
-rw-r--r--http/client.go4
-rw-r--r--locale/translations.go2
-rw-r--r--reader/atom/atom.go4
-rw-r--r--reader/feed/handler.go6
-rw-r--r--reader/feed/parser.go6
-rw-r--r--reader/icon/finder.go6
-rw-r--r--reader/json/json.go4
-rw-r--r--reader/rdf/rdf.go4
-rw-r--r--reader/rss/rss.go4
-rw-r--r--reader/subscription/finder.go4
-rw-r--r--server/core/context.go4
-rw-r--r--server/core/handler.go4
-rw-r--r--server/template/common.go2
-rw-r--r--server/template/template.go4
-rw-r--r--server/template/views.go2
-rw-r--r--server/ui/controller/proxy.go4
-rw-r--r--storage/category.go22
-rw-r--r--storage/entry.go8
-rw-r--r--storage/entry_query_builder.go8
-rw-r--r--storage/feed.go16
-rw-r--r--storage/icon.go14
-rw-r--r--storage/job.go6
-rw-r--r--storage/session.go6
-rw-r--r--storage/timezone.go4
-rw-r--r--storage/user.go24
-rw-r--r--storage/user_session.go4
-rw-r--r--timer/timer.go (renamed from helper/time.go)4
31 files changed, 97 insertions, 97 deletions
diff --git a/helper/crypto.go b/crypto/crypto.go
index 6a20416..ea8ea2b 100644
--- a/helper/crypto.go
+++ b/crypto/crypto.go
@@ -1,8 +1,8 @@
-// Copyright 2017 Frédéric Guillot. All rights reserved.
+// Copyright 2018 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
-package helper
+package crypto
import (
"crypto/rand"
diff --git a/server/template/helper/LICENSE b/duration/LICENSE
index 036a2a1..036a2a1 100644
--- a/server/template/helper/LICENSE
+++ b/duration/LICENSE
diff --git a/server/template/helper/elapsed.go b/duration/duration.go
index df6fcdd..b31d139 100644
--- a/server/template/helper/elapsed.go
+++ b/duration/duration.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT License
// that can be found in the LICENSE file.
-package helper
+package duration
import (
"math"
@@ -26,9 +26,9 @@ var (
Years = `%d years ago`
)
-// GetElapsedTime returns in a human readable format the elapsed time
+// ElapsedTime returns in a human readable format the elapsed time
// since the given datetime.
-func GetElapsedTime(translator *locale.Language, t time.Time) string {
+func ElapsedTime(translator *locale.Language, t time.Time) string {
if t.IsZero() || time.Now().Before(t) {
return translator.Get(NotYet)
}
diff --git a/server/template/helper/elapsed_test.go b/duration/duration_test.go
index d65f84f..c9a4663 100644
--- a/server/template/helper/elapsed_test.go
+++ b/duration/duration_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT License
// that can be found in the LICENSE file.
-package helper
+package duration
import (
"fmt"
@@ -31,7 +31,7 @@ func TestElapsedTime(t *testing.T) {
{time.Now().Add(-time.Hour * 24 * 365 * 3), fmt.Sprintf(Years, 3)},
}
for i, tt := range dt {
- if out := GetElapsedTime(&locale.Language{}, tt.in); out != tt.out {
+ if out := ElapsedTime(&locale.Language{}, tt.in); out != tt.out {
t.Errorf("%d. content mismatch for %v:exp=%q got=%q", i, tt.in, tt.out, out)
}
}
diff --git a/http/client.go b/http/client.go
index 9ca542a..934c7f5 100644
--- a/http/client.go
+++ b/http/client.go
@@ -15,8 +15,8 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/logger"
+ "github.com/miniflux/miniflux/timer"
)
// Note: Some websites have a user agent filter.
@@ -73,7 +73,7 @@ func (c *Client) PostJSON(data interface{}) (*Response, error) {
}
func (c *Client) executeRequest(request *http.Request) (*Response, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[HttpClient] url=%s", c.url))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[HttpClient] url=%s", c.url))
client := c.buildClient()
resp, err := client.Do(request)
diff --git a/locale/translations.go b/locale/translations.go
index e32f754..132ed31 100644
--- a/locale/translations.go
+++ b/locale/translations.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// 2017-12-29 14:34:59.486421907 -0800 PST m=+0.007402806
+// 2017-12-31 18:38:42.071995118 -0800 PST m=+0.052826276
package locale
diff --git a/reader/atom/atom.go b/reader/atom/atom.go
index 61844a5..68a3903 100644
--- a/reader/atom/atom.go
+++ b/reader/atom/atom.go
@@ -10,7 +10,7 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
"github.com/miniflux/miniflux/reader/date"
@@ -163,7 +163,7 @@ func getContent(a *atomEntry) string {
func getHash(a *atomEntry) string {
for _, value := range []string{a.ID, getURL(a.Links)} {
if value != "" {
- return helper.Hash(value)
+ return crypto.Hash(value)
}
}
diff --git a/reader/feed/handler.go b/reader/feed/handler.go
index e804e29..83cbc6f 100644
--- a/reader/feed/handler.go
+++ b/reader/feed/handler.go
@@ -9,13 +9,13 @@ import (
"time"
"github.com/miniflux/miniflux/errors"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/http"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
"github.com/miniflux/miniflux/reader/icon"
"github.com/miniflux/miniflux/reader/processor"
"github.com/miniflux/miniflux/storage"
+ "github.com/miniflux/miniflux/timer"
)
var (
@@ -34,7 +34,7 @@ type Handler struct {
// CreateFeed fetch, parse and store a new feed.
func (h *Handler) CreateFeed(userID, categoryID int64, url string, crawler bool) (*model.Feed, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Handler:CreateFeed] feedUrl=%s", url))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Handler:CreateFeed] feedUrl=%s", url))
if !h.store.CategoryExists(userID, categoryID) {
return nil, errors.NewLocalizedError(errCategoryNotFound)
@@ -96,7 +96,7 @@ func (h *Handler) CreateFeed(userID, categoryID int64, url string, crawler bool)
// RefreshFeed fetch and update a feed if necessary.
func (h *Handler) RefreshFeed(userID, feedID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Handler:RefreshFeed] feedID=%d", feedID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Handler:RefreshFeed] feedID=%d", feedID))
originalFeed, err := h.store.FeedByID(userID, feedID)
if err != nil {
diff --git a/reader/feed/parser.go b/reader/feed/parser.go
index 5f87708..e612f39 100644
--- a/reader/feed/parser.go
+++ b/reader/feed/parser.go
@@ -12,12 +12,12 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
"github.com/miniflux/miniflux/reader/atom"
"github.com/miniflux/miniflux/reader/json"
"github.com/miniflux/miniflux/reader/rdf"
"github.com/miniflux/miniflux/reader/rss"
+ "github.com/miniflux/miniflux/timer"
"golang.org/x/net/html/charset"
)
@@ -33,7 +33,7 @@ const (
// DetectFeedFormat detect feed format from input data.
func DetectFeedFormat(data io.Reader) string {
- defer helper.ExecutionTime(time.Now(), "[Feed:DetectFeedFormat]")
+ defer timer.ExecutionTime(time.Now(), "[Feed:DetectFeedFormat]")
var buffer bytes.Buffer
tee := io.TeeReader(data, &buffer)
@@ -67,7 +67,7 @@ func DetectFeedFormat(data io.Reader) string {
}
func parseFeed(data io.Reader) (*model.Feed, error) {
- defer helper.ExecutionTime(time.Now(), "[Feed:ParseFeed]")
+ defer timer.ExecutionTime(time.Now(), "[Feed:ParseFeed]")
var buffer bytes.Buffer
io.Copy(&buffer, data)
diff --git a/reader/icon/finder.go b/reader/icon/finder.go
index 977a089..2e7cb16 100644
--- a/reader/icon/finder.go
+++ b/reader/icon/finder.go
@@ -11,7 +11,7 @@ import (
"io/ioutil"
"strings"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/http"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
@@ -107,7 +107,7 @@ func downloadIcon(iconURL string) (*model.Icon, error) {
}
icon := &model.Icon{
- Hash: helper.HashFromBytes(body),
+ Hash: crypto.HashFromBytes(body),
MimeType: response.ContentType,
Content: body,
}
@@ -146,7 +146,7 @@ func parseImageDataURL(value string) (*model.Icon, error) {
}
icon := &model.Icon{
- Hash: helper.HashFromBytes(blob),
+ Hash: crypto.HashFromBytes(blob),
Content: blob,
MimeType: mimeType,
}
diff --git a/reader/json/json.go b/reader/json/json.go
index 900a920..81b38f6 100644
--- a/reader/json/json.go
+++ b/reader/json/json.go
@@ -8,7 +8,7 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
"github.com/miniflux/miniflux/reader/date"
@@ -105,7 +105,7 @@ func (j *jsonItem) GetAuthor() string {
func (j *jsonItem) GetHash() string {
for _, value := range []string{j.ID, j.URL, j.Text + j.HTML + j.Summary} {
if value != "" {
- return helper.Hash(value)
+ return crypto.Hash(value)
}
}
diff --git a/reader/rdf/rdf.go b/reader/rdf/rdf.go
index 3586f6e..d9f3403 100644
--- a/reader/rdf/rdf.go
+++ b/reader/rdf/rdf.go
@@ -9,7 +9,7 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/model"
"github.com/miniflux/miniflux/reader/sanitizer"
"github.com/miniflux/miniflux/url"
@@ -73,5 +73,5 @@ func getHash(r *rdfItem) string {
value = r.Title + r.Description
}
- return helper.Hash(value)
+ return crypto.Hash(value)
}
diff --git a/reader/rss/rss.go b/reader/rss/rss.go
index 2a7dc3e..b7fc1d0 100644
--- a/reader/rss/rss.go
+++ b/reader/rss/rss.go
@@ -11,7 +11,7 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
"github.com/miniflux/miniflux/reader/date"
@@ -157,7 +157,7 @@ func (r *rssItem) GetAuthor() string {
func (r *rssItem) GetHash() string {
for _, value := range []string{r.GUID, r.GetURL()} {
if value != "" {
- return helper.Hash(value)
+ return crypto.Hash(value)
}
}
diff --git a/reader/subscription/finder.go b/reader/subscription/finder.go
index a550b13..c3bf8bb 100644
--- a/reader/subscription/finder.go
+++ b/reader/subscription/finder.go
@@ -11,10 +11,10 @@ import (
"time"
"github.com/miniflux/miniflux/errors"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/http"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/reader/feed"
+ "github.com/miniflux/miniflux/timer"
"github.com/miniflux/miniflux/url"
"github.com/PuerkitoBio/goquery"
@@ -27,7 +27,7 @@ var (
// FindSubscriptions downloads and try to find one or more subscriptions from an URL.
func FindSubscriptions(websiteURL string) (Subscriptions, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[FindSubscriptions] url=%s", websiteURL))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[FindSubscriptions] url=%s", websiteURL))
client := http.NewClient(websiteURL)
response, err := client.Get()
diff --git a/server/core/context.go b/server/core/context.go
index d80ce1f..8145b47 100644
--- a/server/core/context.go
+++ b/server/core/context.go
@@ -7,7 +7,7 @@ package core
import (
"net/http"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/locale"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
@@ -111,7 +111,7 @@ func (c *Context) OAuth2State() string {
// GenerateOAuth2State generate a new OAuth2 state.
func (c *Context) GenerateOAuth2State() string {
- state := helper.GenerateRandomString(32)
+ state := crypto.GenerateRandomString(32)
c.store.UpdateSessionField(c.SessionID(), "oauth2_state", state)
return state
}
diff --git a/server/core/handler.go b/server/core/handler.go
index 647d979..e6aca98 100644
--- a/server/core/handler.go
+++ b/server/core/handler.go
@@ -9,12 +9,12 @@ import (
"time"
"github.com/miniflux/miniflux/config"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/locale"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/server/middleware"
"github.com/miniflux/miniflux/server/template"
"github.com/miniflux/miniflux/storage"
+ "github.com/miniflux/miniflux/timer"
"github.com/gorilla/mux"
"github.com/tomasen/realip"
@@ -36,7 +36,7 @@ type Handler struct {
// Use is a wrapper around an HTTP handler.
func (h *Handler) Use(f HandlerFunc) http.Handler {
return h.middleware.WrapFunc(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- defer helper.ExecutionTime(time.Now(), r.URL.Path)
+ defer timer.ExecutionTime(time.Now(), r.URL.Path)
logger.Debug("[HTTP] %s %s %s", realip.RealIP(r), r.Method, r.URL.Path)
if r.Header.Get("X-Forwarded-Proto") == "https" {
diff --git a/server/template/common.go b/server/template/common.go
index 621dc08..f0a481d 100644
--- a/server/template/common.go
+++ b/server/template/common.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// 2017-12-28 18:55:07.408638507 -0800 PST m=+0.035359093
+// 2017-12-31 18:38:42.07097409 -0800 PST m=+0.051805248
package template
diff --git a/server/template/template.go b/server/template/template.go
index 59dd0fb..a87d097 100644
--- a/server/template/template.go
+++ b/server/template/template.go
@@ -13,11 +13,11 @@ import (
"time"
"github.com/miniflux/miniflux/config"
+ "github.com/miniflux/miniflux/duration"
"github.com/miniflux/miniflux/errors"
"github.com/miniflux/miniflux/locale"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/server/route"
- "github.com/miniflux/miniflux/server/template/helper"
"github.com/miniflux/miniflux/server/ui/filter"
"github.com/miniflux/miniflux/url"
@@ -83,7 +83,7 @@ func (e *Engine) parseAll() {
return ts.Format("2006-01-02 15:04:05")
},
"elapsed": func(ts time.Time) string {
- return helper.GetElapsedTime(e.currentLocale, ts)
+ return duration.ElapsedTime(e.currentLocale, ts)
},
"t": func(key interface{}, args ...interface{}) string {
switch key.(type) {
diff --git a/server/template/views.go b/server/template/views.go
index b5b62be..4eac6e4 100644
--- a/server/template/views.go
+++ b/server/template/views.go
@@ -1,5 +1,5 @@
// Code generated by go generate; DO NOT EDIT.
-// 2017-12-28 19:08:21.190684499 -0800 PST m=+0.036802540
+// 2017-12-31 18:38:42.048775793 -0800 PST m=+0.029606951
package template
diff --git a/server/ui/controller/proxy.go b/server/ui/controller/proxy.go
index 6d3f518..6ee52b8 100644
--- a/server/ui/controller/proxy.go
+++ b/server/ui/controller/proxy.go
@@ -10,7 +10,7 @@ import (
"io/ioutil"
"time"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/http"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/server/core"
@@ -50,7 +50,7 @@ func (c *Controller) ImageProxy(ctx *core.Context, request *core.Request, respon
}
body, _ := ioutil.ReadAll(resp.Body)
- etag := helper.HashFromBytes(body)
+ etag := crypto.HashFromBytes(body)
response.Cache(resp.ContentType, etag, body, 72*time.Hour)
}
diff --git a/storage/category.go b/storage/category.go
index a9de759..197b78b 100644
--- a/storage/category.go
+++ b/storage/category.go
@@ -10,13 +10,13 @@ import (
"fmt"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
)
// AnotherCategoryExists checks if another category exists with the same title.
func (s *Storage) AnotherCategoryExists(userID, categoryID int64, title string) bool {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:AnotherCategoryExists] userID=%d, categoryID=%d, title=%s", userID, categoryID, title))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:AnotherCategoryExists] userID=%d, categoryID=%d, title=%s", userID, categoryID, title))
var result int
query := `SELECT count(*) as c FROM categories WHERE user_id=$1 AND id != $2 AND title=$3`
@@ -26,7 +26,7 @@ func (s *Storage) AnotherCategoryExists(userID, categoryID int64, title string)
// CategoryExists checks if the given category exists into the database.
func (s *Storage) CategoryExists(userID, categoryID int64) bool {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CategoryExists] userID=%d, categoryID=%d", userID, categoryID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CategoryExists] userID=%d, categoryID=%d", userID, categoryID))
var result int
query := `SELECT count(*) as c FROM categories WHERE user_id=$1 AND id=$2`
@@ -36,7 +36,7 @@ func (s *Storage) CategoryExists(userID, categoryID int64) bool {
// Category returns a category from the database.
func (s *Storage) Category(userID, categoryID int64) (*model.Category, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Category] userID=%d, getCategory=%d", userID, categoryID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Category] userID=%d, getCategory=%d", userID, categoryID))
var category model.Category
query := `SELECT id, user_id, title FROM categories WHERE user_id=$1 AND id=$2`
@@ -52,7 +52,7 @@ func (s *Storage) Category(userID, categoryID int64) (*model.Category, error) {
// FirstCategory returns the first category for the given user.
func (s *Storage) FirstCategory(userID int64) (*model.Category, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FirstCategory] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FirstCategory] userID=%d", userID))
var category model.Category
query := `SELECT id, user_id, title FROM categories WHERE user_id=$1 ORDER BY title ASC LIMIT 1`
@@ -68,7 +68,7 @@ func (s *Storage) FirstCategory(userID int64) (*model.Category, error) {
// CategoryByTitle finds a category by the title.
func (s *Storage) CategoryByTitle(userID int64, title string) (*model.Category, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CategoryByTitle] userID=%d, title=%s", userID, title))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CategoryByTitle] userID=%d, title=%s", userID, title))
var category model.Category
query := `SELECT id, user_id, title FROM categories WHERE user_id=$1 AND title=$2`
@@ -84,7 +84,7 @@ func (s *Storage) CategoryByTitle(userID int64, title string) (*model.Category,
// Categories returns all categories that belongs to the given user.
func (s *Storage) Categories(userID int64) (model.Categories, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Categories] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Categories] userID=%d", userID))
query := `SELECT id, user_id, title FROM categories WHERE user_id=$1 ORDER BY title ASC`
rows, err := s.db.Query(query, userID)
@@ -108,7 +108,7 @@ func (s *Storage) Categories(userID int64) (model.Categories, error) {
// CategoriesWithFeedCount returns all categories with the number of feeds.
func (s *Storage) CategoriesWithFeedCount(userID int64) (model.Categories, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CategoriesWithFeedCount] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CategoriesWithFeedCount] userID=%d", userID))
query := `SELECT
c.id, c.user_id, c.title,
(SELECT count(*) FROM feeds WHERE feeds.category_id=c.id) AS count
@@ -135,7 +135,7 @@ func (s *Storage) CategoriesWithFeedCount(userID int64) (model.Categories, error
// CreateCategory creates a new category.
func (s *Storage) CreateCategory(category *model.Category) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateCategory] title=%s", category.Title))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateCategory] title=%s", category.Title))
query := `
INSERT INTO categories
@@ -159,7 +159,7 @@ func (s *Storage) CreateCategory(category *model.Category) error {
// UpdateCategory updates an existing category.
func (s *Storage) UpdateCategory(category *model.Category) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UpdateCategory] categoryID=%d", category.ID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UpdateCategory] categoryID=%d", category.ID))
query := `UPDATE categories SET title=$1 WHERE id=$2 AND user_id=$3`
_, err := s.db.Exec(
@@ -178,7 +178,7 @@ func (s *Storage) UpdateCategory(category *model.Category) error {
// RemoveCategory deletes a category.
func (s *Storage) RemoveCategory(userID, categoryID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:RemoveCategory] userID=%d, categoryID=%d", userID, categoryID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:RemoveCategory] userID=%d, categoryID=%d", userID, categoryID))
result, err := s.db.Exec("DELETE FROM categories WHERE id = $1 AND user_id = $2", categoryID, userID)
if err != nil {
diff --git a/storage/entry.go b/storage/entry.go
index 176dcde..3be6c92 100644
--- a/storage/entry.go
+++ b/storage/entry.go
@@ -9,9 +9,9 @@ import (
"fmt"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
"github.com/lib/pq"
)
@@ -159,7 +159,7 @@ func (s *Storage) cleanupEntries(feedID int64, entryHashes []string) error {
// SetEntriesStatus update the status of the given list of entries.
func (s *Storage) SetEntriesStatus(userID int64, entryIDs []int64, status string) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:SetEntriesStatus] userID=%d, entryIDs=%v, status=%s", userID, entryIDs, status))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:SetEntriesStatus] userID=%d, entryIDs=%v, status=%s", userID, entryIDs, status))
query := `UPDATE entries SET status=$1 WHERE user_id=$2 AND id=ANY($3)`
result, err := s.db.Exec(query, status, userID, pq.Array(entryIDs))
@@ -181,7 +181,7 @@ func (s *Storage) SetEntriesStatus(userID int64, entryIDs []int64, status string
// ToggleBookmark toggles entry bookmark value.
func (s *Storage) ToggleBookmark(userID int64, entryID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:ToggleBookmark] userID=%d, entryID=%d", userID, entryID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:ToggleBookmark] userID=%d, entryID=%d", userID, entryID))
query := `UPDATE entries SET starred = NOT starred WHERE user_id=$1 AND id=$2`
result, err := s.db.Exec(query, userID, entryID)
@@ -203,7 +203,7 @@ func (s *Storage) ToggleBookmark(userID int64, entryID int64) error {
// FlushHistory set all entries with the status "read" to "removed".
func (s *Storage) FlushHistory(userID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FlushHistory] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FlushHistory] userID=%d", userID))
query := `UPDATE entries SET status=$1 WHERE user_id=$2 AND status=$3 AND starred='f'`
_, err := s.db.Exec(query, model.EntryStatusRemoved, userID, model.EntryStatusRead)
diff --git a/storage/entry_query_builder.go b/storage/entry_query_builder.go
index 99fa4e5..7c8d924 100644
--- a/storage/entry_query_builder.go
+++ b/storage/entry_query_builder.go
@@ -11,8 +11,8 @@ import (
"github.com/lib/pq"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
)
// EntryQueryBuilder builds a SQL query to fetch entries.
@@ -114,7 +114,7 @@ func (e *EntryQueryBuilder) WithOffset(offset int) *EntryQueryBuilder {
// CountEntries count the number of entries that match the condition.
func (e *EntryQueryBuilder) CountEntries() (count int, err error) {
- defer helper.ExecutionTime(
+ defer timer.ExecutionTime(
time.Now(),
fmt.Sprintf("[EntryQueryBuilder:CountEntries] userID=%d, feedID=%d, status=%s", e.userID, e.feedID, e.status),
)
@@ -152,7 +152,7 @@ func (e *EntryQueryBuilder) GetEntry() (*model.Entry, error) {
// GetEntries returns a list of entries that match the condition.
func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
debugStr := "[EntryQueryBuilder:GetEntries] userID=%d, feedID=%d, categoryID=%d, status=%s, order=%s, direction=%s, offset=%d, limit=%d"
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf(debugStr, e.userID, e.feedID, e.categoryID, e.status, e.order, e.direction, e.offset, e.limit))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf(debugStr, e.userID, e.feedID, e.categoryID, e.status, e.order, e.direction, e.offset, e.limit))
query := `
SELECT
@@ -233,7 +233,7 @@ func (e *EntryQueryBuilder) GetEntries() (model.Entries, error) {
// GetEntryIDs returns a list of entry IDs that match the condition.
func (e *EntryQueryBuilder) GetEntryIDs() ([]int64, error) {
debugStr := "[EntryQueryBuilder:GetEntryIDs] userID=%d, feedID=%d, categoryID=%d, status=%s, order=%s, direction=%s, offset=%d, limit=%d"
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf(debugStr, e.userID, e.feedID, e.categoryID, e.status, e.order, e.direction, e.offset, e.limit))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf(debugStr, e.userID, e.feedID, e.categoryID, e.status, e.order, e.direction, e.offset, e.limit))
query := `
SELECT
diff --git a/storage/feed.go b/storage/feed.go
index ae6d50a..87b234a 100644
--- a/storage/feed.go
+++ b/storage/feed.go
@@ -10,13 +10,13 @@ import (
"fmt"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
)
// FeedExists checks if the given feed exists.
func (s *Storage) FeedExists(userID, feedID int64) bool {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FeedExists] userID=%d, feedID=%d", userID, feedID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FeedExists] userID=%d, feedID=%d", userID, feedID))
var result int
query := `SELECT count(*) as c FROM feeds WHERE user_id=$1 AND id=$2`
@@ -26,7 +26,7 @@ func (s *Storage) FeedExists(userID, feedID int64) bool {
// FeedURLExists checks if feed URL already exists.
func (s *Storage) FeedURLExists(userID int64, feedURL string) bool {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FeedURLExists] userID=%d, feedURL=%s", userID, feedURL))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FeedURLExists] userID=%d, feedURL=%s", userID, feedURL))
var result int
query := `SELECT count(*) as c FROM feeds WHERE user_id=$1 AND feed_url=$2`
@@ -47,7 +47,7 @@ func (s *Storage) CountFeeds(userID int64) int {
// Feeds returns all feeds of the given user.
func (s *Storage) Feeds(userID int64) (model.Feeds, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Feeds] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Feeds] userID=%d", userID))
feeds := make(model.Feeds, 0)
query := `SELECT
@@ -110,7 +110,7 @@ func (s *Storage) Feeds(userID int64) (model.Feeds, error) {
// FeedByID returns a feed by the ID.
func (s *Storage) FeedByID(userID, feedID int64) (*model.Feed, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FeedByID] feedID=%d", feedID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:FeedByID] feedID=%d", feedID))
var feed model.Feed
var iconID interface{}
@@ -165,7 +165,7 @@ func (s *Storage) FeedByID(userID, feedID int64) (*model.Feed, error) {
// CreateFeed creates a new feed.
func (s *Storage) CreateFeed(feed *model.Feed) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateFeed] feedURL=%s", feed.FeedURL))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateFeed] feedURL=%s", feed.FeedURL))
sql := `
INSERT INTO feeds
(feed_url, site_url, title, category_id, user_id, etag_header, last_modified_header, crawler)
@@ -202,7 +202,7 @@ func (s *Storage) CreateFeed(feed *model.Feed) error {
// UpdateFeed updates an existing feed.
func (s *Storage) UpdateFeed(feed *model.Feed) (err error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UpdateFeed] feedURL=%s", feed.FeedURL))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UpdateFeed] feedURL=%s", feed.FeedURL))
query := `UPDATE feeds SET
feed_url=$1, site_url=$2, title=$3, category_id=$4, etag_header=$5, last_modified_header=$6, checked_at=$7,
@@ -235,7 +235,7 @@ func (s *Storage) UpdateFeed(feed *model.Feed) (err error) {
// RemoveFeed removes a feed.
func (s *Storage) RemoveFeed(userID, feedID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:RemoveFeed] userID=%d, feedID=%d", userID, feedID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:RemoveFeed] userID=%d, feedID=%d", userID, feedID))
result, err := s.db.Exec("DELETE FROM feeds WHERE id = $1 AND user_id = $2", feedID, userID)
if err != nil {
diff --git a/storage/icon.go b/storage/icon.go
index f5c71cb..5e8b5dc 100644
--- a/storage/icon.go
+++ b/storage/icon.go
@@ -10,8 +10,8 @@ import (
"strings"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
)
// HasIcon checks if the given feed has an icon.
@@ -24,7 +24,7 @@ func (s *Storage) HasIcon(feedID int64) bool {
// IconByID returns an icon by the ID.
func (s *Storage) IconByID(iconID int64) (*model.Icon, error) {
- defer helper.ExecutionTime(time.Now(), "[Storage:IconByID]")
+ defer timer.ExecutionTime(time.Now(), "[Storage:IconByID]")
var icon model.Icon
query := `SELECT id, hash, mime_type, content FROM icons WHERE id=$1`
@@ -40,7 +40,7 @@ func (s *Storage) IconByID(iconID int64) (*model.Icon, error) {
// IconByFeedID returns a feed icon.
func (s *Storage) IconByFeedID(userID, feedID int64) (*model.Icon, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:IconByFeedID] userID=%d, feedID=%d", userID, feedID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:IconByFeedID] userID=%d, feedID=%d", userID, feedID))
query := `
SELECT
icons.id, icons.hash, icons.mime_type, icons.content
@@ -62,7 +62,7 @@ func (s *Storage) IconByFeedID(userID, feedID int64) (*model.Icon, error) {
// IconByHash returns an icon by the hash (checksum).
func (s *Storage) IconByHash(icon *model.Icon) error {
- defer helper.ExecutionTime(time.Now(), "[Storage:IconByHash]")
+ defer timer.ExecutionTime(time.Now(), "[Storage:IconByHash]")
err := s.db.QueryRow(`SELECT id FROM icons WHERE hash=$1`, icon.Hash).Scan(&icon.ID)
if err == sql.ErrNoRows {
@@ -76,7 +76,7 @@ func (s *Storage) IconByHash(icon *model.Icon) error {
// CreateIcon creates a new icon.
func (s *Storage) CreateIcon(icon *model.Icon) error {
- defer helper.ExecutionTime(time.Now(), "[Storage:CreateIcon]")
+ defer timer.ExecutionTime(time.Now(), "[Storage:CreateIcon]")
query := `
INSERT INTO icons
@@ -101,7 +101,7 @@ func (s *Storage) CreateIcon(icon *model.Icon) error {
// CreateFeedIcon creates an icon and associate the icon to the given feed.
func (s *Storage) CreateFeedIcon(feed *model.Feed, icon *model.Icon) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateFeedIcon] feedID=%d", feed.ID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateFeedIcon] feedID=%d", feed.ID))
err := s.IconByHash(icon)
if err != nil {
@@ -125,7 +125,7 @@ func (s *Storage) CreateFeedIcon(feed *model.Feed, icon *model.Icon) error {
// Icons returns all icons tht belongs to a user.
func (s *Storage) Icons(userID int64) (model.Icons, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Icons] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:Icons] userID=%d", userID))
query := `
SELECT
icons.id, icons.hash, icons.mime_type, icons.content
diff --git a/storage/job.go b/storage/job.go
index f8b11d8..20a0efa 100644
--- a/storage/job.go
+++ b/storage/job.go
@@ -8,15 +8,15 @@ import (
"fmt"
"time"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
)
const maxParsingError = 3
// NewBatch returns a serie of jobs.
func (s *Storage) NewBatch(batchSize int) (jobs model.JobList, err error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:GetJobs] batchSize=%d", batchSize))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:GetJobs] batchSize=%d", batchSize))
query := `
SELECT
id, user_id
@@ -29,7 +29,7 @@ func (s *Storage) NewBatch(batchSize int) (jobs model.JobList, err error) {
// NewUserBatch returns a serie of jobs but only for a given user.
func (s *Storage) NewUserBatch(userID int64, batchSize int) (jobs model.JobList, err error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:GetUserJobs] batchSize=%d, userID=%d", batchSize, userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:GetUserJobs] batchSize=%d, userID=%d", batchSize, userID))
query := `
SELECT
id, user_id
diff --git a/storage/session.go b/storage/session.go
index 106d618..1e6fb42 100644
--- a/storage/session.go
+++ b/storage/session.go
@@ -8,15 +8,15 @@ import (
"database/sql"
"fmt"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/model"
)
// CreateSession creates a new session.
func (s *Storage) CreateSession() (*model.Session, error) {
session := model.Session{
- ID: helper.GenerateRandomString(32),
- Data: &model.SessionData{CSRF: helper.GenerateRandomString(64)},
+ ID: crypto.GenerateRandomString(32),
+ Data: &model.SessionData{CSRF: crypto.GenerateRandomString(64)},
}
query := "INSERT INTO sessions (id, data) VALUES ($1, $2)"
diff --git a/storage/timezone.go b/storage/timezone.go
index 72dbb1d..949a6af 100644
--- a/storage/timezone.go
+++ b/storage/timezone.go
@@ -8,12 +8,12 @@ import (
"fmt"
"time"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/timer"
)
// Timezones returns all timezones supported by the database.
func (s *Storage) Timezones() (map[string]string, error) {
- defer helper.ExecutionTime(time.Now(), "[Storage:Timezones]")
+ defer timer.ExecutionTime(time.Now(), "[Storage:Timezones]")
timezones := make(map[string]string)
query := `select name from pg_timezone_names() order by name asc`
diff --git a/storage/user.go b/storage/user.go
index 31aadf0..5d64b65 100644
--- a/storage/user.go
+++ b/storage/user.go
@@ -13,15 +13,15 @@ import (
"github.com/lib/pq/hstore"
- "github.com/miniflux/miniflux/helper"
"github.com/miniflux/miniflux/model"
+ "github.com/miniflux/miniflux/timer"
"golang.org/x/crypto/bcrypt"
)
// SetLastLogin updates the last login date of a user.
func (s *Storage) SetLastLogin(userID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:SetLastLogin] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:SetLastLogin] userID=%d", userID))
query := "UPDATE users SET last_login_at=now() WHERE id=$1"
_, err := s.db.Exec(query, userID)
if err != nil {
@@ -33,7 +33,7 @@ func (s *Storage) SetLastLogin(userID int64) error {
// UserExists checks if a user exists by using the given username.
func (s *Storage) UserExists(username string) bool {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserExists] username=%s", username))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserExists] username=%s", username))
var result int
s.db.QueryRow(`SELECT count(*) as c FROM users WHERE username=LOWER($1)`, username).Scan(&result)
@@ -42,7 +42,7 @@ func (s *Storage) UserExists(username string) bool {
// AnotherUserExists checks if another user exists with the given username.
func (s *Storage) AnotherUserExists(userID int64, username string) bool {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:AnotherUserExists] userID=%d, username=%s", userID, username))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:AnotherUserExists] userID=%d, username=%s", userID, username))
var result int
s.db.QueryRow(`SELECT count(*) as c FROM users WHERE id != $1 AND username=LOWER($2)`, userID, username).Scan(&result)
@@ -51,7 +51,7 @@ func (s *Storage) AnotherUserExists(userID int64, username string) bool {
// CreateUser creates a new user.
func (s *Storage) CreateUser(user *model.User) (err error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateUser] username=%s", user.Username))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:CreateUser] username=%s", user.Username))
password := ""
extra := hstore.Hstore{Map: make(map[string]sql.NullString)}
@@ -114,7 +114,7 @@ func (s *Storage) RemoveExtraField(userID int64, field string) error {
// UpdateUser updates a user.
func (s *Storage) UpdateUser(user *model.User) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UpdateUser] userID=%d", user.ID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UpdateUser] userID=%d", user.ID))
if user.Password != "" {
hashedPassword, err := hashPassword(user.Password)
@@ -177,7 +177,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
// UserByID finds a user by the ID.
func (s *Storage) UserByID(userID int64) (*model.User, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserByID] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserByID] userID=%d", userID))
query := `SELECT
id, username, is_admin, theme, language, timezone, entry_direction, last_login_at, extra
FROM users
@@ -188,7 +188,7 @@ func (s *Storage) UserByID(userID int64) (*model.User, error) {
// UserByUsername finds a user by the username.
func (s *Storage) UserByUsername(username string) (*model.User, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserByUsername] username=%s", username))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserByUsername] username=%s", username))
query := `SELECT
id, username, is_admin, theme, language, timezone, entry_direction, last_login_at, extra
FROM users
@@ -199,7 +199,7 @@ func (s *Storage) UserByUsername(username string) (*model.User, error) {
// UserByExtraField finds a user by an extra field value.
func (s *Storage) UserByExtraField(field, value string) (*model.User, error) {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserByExtraField] field=%s", field))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:UserByExtraField] field=%s", field))
query := `SELECT
id, username, is_admin, theme, language, timezone, entry_direction, last_login_at, extra
FROM users
@@ -241,7 +241,7 @@ func (s *Storage) fetchUser(query string, args ...interface{}) (*model.User, err
// RemoveUser deletes a user.
func (s *Storage) RemoveUser(userID int64) error {
- defer helper.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:RemoveUser] userID=%d", userID))
+ defer timer.ExecutionTime(time.Now(), fmt.Sprintf("[Storage:RemoveUser] userID=%d", userID))
result, err := s.db.Exec("DELETE FROM users WHERE id = $1", userID)
if err != nil {
@@ -262,7 +262,7 @@ func (s *Storage) RemoveUser(userID int64) error {
// Users returns all users.
func (s *Storage) Users() (model.Users, error) {
- defer helper.ExecutionTime(time.Now(), "[Storage:Users]")
+ defer timer.ExecutionTime(time.Now(), "[Storage:Users]")
query := `
SELECT
id, username, is_admin, theme, language, timezone, entry_direction, last_login_at, extra
@@ -309,7 +309,7 @@ func (s *Storage) Users() (model.Users, error) {
// CheckPassword validate the hashed password.
func (s *Storage) CheckPassword(username, password string) error {
- defer helper.ExecutionTime(time.Now(), "[Storage:CheckPassword]")
+ defer timer.ExecutionTime(time.Now(), "[Storage:CheckPassword]")
var hash string
username = strings.ToLower(username)
diff --git a/storage/user_session.go b/storage/user_session.go
index 9a87cdf..3649f42 100644
--- a/storage/user_session.go
+++ b/storage/user_session.go
@@ -8,7 +8,7 @@ import (
"database/sql"
"fmt"
- "github.com/miniflux/miniflux/helper"
+ "github.com/miniflux/miniflux/crypto"
"github.com/miniflux/miniflux/model"
)
@@ -55,7 +55,7 @@ func (s *Storage) CreateUserSession(username, userAgent, ip string) (sessionID s
return "", fmt.Errorf("unable to fetch UserID: %v", err)
}
- token := helper.GenerateRandomString(64)
+ token := crypto.GenerateRandomString(64)
query := "INSERT INTO user_sessions (token, user_id, user_agent, ip) VALUES ($1, $2, $3, $4)"
_, err = s.db.Exec(query, token, userID, userAgent, ip)
if err != nil {
diff --git a/helper/time.go b/timer/timer.go
index ff6c97e..d7444ca 100644
--- a/helper/time.go
+++ b/timer/timer.go
@@ -1,8 +1,8 @@
-// Copyright 2017 Frédéric Guillot. All rights reserved.
+// Copyright 2018 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
-package helper
+package timer
import (
"time"