Updated linter threw new warnings. Fixed.
This commit is contained in:
parent
055ca479f0
commit
6ffa020c5f
@ -74,7 +74,7 @@ func saveEvent(id string, userID string, body string, eventType string, hidden *
|
||||
func getChat(query string) []events.UserMessageEvent {
|
||||
history := make([]events.UserMessageEvent, 0)
|
||||
rows, err := _datastore.DB.Query(query)
|
||||
if err != nil {
|
||||
if err != nil || rows.Err() != nil {
|
||||
log.Errorln("error fetching chat history", err)
|
||||
return history
|
||||
}
|
||||
|
@ -42,7 +42,6 @@ func InsertWebhook(url string, events []models.EventType) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
stmt, err := tx.Prepare("INSERT INTO webhooks(url, events) values(?, ?)")
|
||||
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -74,7 +73,6 @@ func DeleteWebhook(id int) error {
|
||||
return err
|
||||
}
|
||||
stmt, err := tx.Prepare("DELETE FROM webhooks WHERE id = ?")
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -101,7 +99,7 @@ func DeleteWebhook(id int) error {
|
||||
func GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
webhooks := make([]models.Webhook, 0)
|
||||
|
||||
var query = `SELECT * FROM (
|
||||
query := `SELECT * FROM (
|
||||
WITH RECURSIVE split(id, url, event, rest) AS (
|
||||
SELECT id, url, '', events || ',' FROM webhooks
|
||||
UNION ALL
|
||||
@ -116,8 +114,7 @@ func GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
) AS webhook WHERE event IS "` + event + `"`
|
||||
|
||||
rows, err := _db.Query(query)
|
||||
|
||||
if err != nil {
|
||||
if err != nil || rows.Err() != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer rows.Close()
|
||||
@ -146,7 +143,7 @@ func GetWebhooksForEvent(event models.EventType) []models.Webhook {
|
||||
func GetWebhooks() ([]models.Webhook, error) { //nolint
|
||||
webhooks := make([]models.Webhook, 0)
|
||||
|
||||
var query = "SELECT * FROM webhooks"
|
||||
query := "SELECT * FROM webhooks"
|
||||
|
||||
rows, err := _db.Query(query)
|
||||
if err != nil {
|
||||
@ -202,7 +199,6 @@ func SetWebhookAsUsed(webhook models.Webhook) error {
|
||||
return err
|
||||
}
|
||||
stmt, err := tx.Prepare("UPDATE webhooks SET last_used = CURRENT_TIMESTAMP WHERE id = ?")
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user