mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 15:09:42 +00:00
build/linters: Bump Go to v1.25 and golangci-lint to v2.4.0 (#2005)
* build/linters: Bump Go to v1.25 and golangci-lint to v2.4.0 * refactor: Update TODO comments for net.Listen and net.DialTimeout; improve variable naming in websocket and exchange methods * refactor: Rename massageMissingData to backfillMissingData for clarity and update references in RSI and MFI calculations * fix: Correct typo in TODO comment for net.Listen in RPC server
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"time"
|
||||
@@ -46,7 +47,7 @@ func (i *Instance) SetPostgresConnection(con *sql.DB) error {
|
||||
if con == nil {
|
||||
return errNilSQL
|
||||
}
|
||||
if err := con.Ping(); err != nil {
|
||||
if err := con.PingContext(context.TODO()); err != nil {
|
||||
return fmt.Errorf("%w %s", errFailedPing, err)
|
||||
}
|
||||
i.m.Lock()
|
||||
@@ -117,7 +118,7 @@ func (i *Instance) Ping() error {
|
||||
if i.SQL == nil {
|
||||
return errNilSQL
|
||||
}
|
||||
return i.SQL.Ping()
|
||||
return i.SQL.PingContext(context.TODO())
|
||||
}
|
||||
|
||||
// GetSQL returns the sql connection
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// Event inserts a new script event into database with execution details (script name time status hash of script)
|
||||
func Event(id, name, path string, data null.Bytes, executionType, status string, time time.Time) {
|
||||
func Event(id, name, path string, data null.Bytes, executionType, status string, tm time.Time) {
|
||||
if database.DB.SQL == nil {
|
||||
return
|
||||
}
|
||||
@@ -68,7 +68,7 @@ func Event(id, name, path string, data null.Bytes, executionType, status string,
|
||||
|
||||
tempScriptExecution := &modelSQLite.ScriptExecution{
|
||||
ScriptID: id,
|
||||
ExecutionTime: time.UTC().String(),
|
||||
ExecutionTime: tm.UTC().String(),
|
||||
ExecutionStatus: status,
|
||||
ExecutionType: executionType,
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func Event(id, name, path string, data null.Bytes, executionType, status string,
|
||||
}
|
||||
|
||||
tempScriptExecution := &modelPSQL.ScriptExecution{
|
||||
ExecutionTime: time.UTC(),
|
||||
ExecutionTime: tm.UTC(),
|
||||
ExecutionStatus: status,
|
||||
ExecutionType: executionType,
|
||||
}
|
||||
|
||||
@@ -217,14 +217,14 @@ func insertPostgres(ctx context.Context, tx *sql.Tx, trades ...Data) error {
|
||||
}
|
||||
|
||||
// GetByUUID returns a trade by its unique ID
|
||||
func GetByUUID(uuid string) (td Data, err error) {
|
||||
func GetByUUID(u string) (td Data, err error) {
|
||||
if repository.GetSQLDialect() == database.DBSQLite3 || repository.GetSQLDialect() == database.DBSQLite {
|
||||
td, err = getByUUIDSQLite(uuid)
|
||||
td, err = getByUUIDSQLite(u)
|
||||
if err != nil {
|
||||
return td, fmt.Errorf("trade.Get getByUUIDSQLite %w", err)
|
||||
}
|
||||
} else {
|
||||
td, err = getByUUIDPostgres(uuid)
|
||||
td, err = getByUUIDPostgres(u)
|
||||
if err != nil {
|
||||
return td, fmt.Errorf("trade.Get getByUUIDPostgres %w", err)
|
||||
}
|
||||
@@ -233,10 +233,10 @@ func GetByUUID(uuid string) (td Data, err error) {
|
||||
return td, nil
|
||||
}
|
||||
|
||||
func getByUUIDSQLite(uuid string) (Data, error) {
|
||||
func getByUUIDSQLite(u string) (Data, error) {
|
||||
var td Data
|
||||
var ts time.Time
|
||||
query := sqlite3.Trades(qm.Where("id = ?", uuid))
|
||||
query := sqlite3.Trades(qm.Where("id = ?", u))
|
||||
result, err := query.One(context.TODO(), database.DB.SQL)
|
||||
if err != nil {
|
||||
return td, err
|
||||
@@ -262,8 +262,8 @@ func getByUUIDSQLite(uuid string) (Data, error) {
|
||||
return td, nil
|
||||
}
|
||||
|
||||
func getByUUIDPostgres(uuid string) (td Data, err error) {
|
||||
query := postgres.Trades(qm.Where("id = ?", uuid))
|
||||
func getByUUIDPostgres(u string) (td Data, err error) {
|
||||
query := postgres.Trades(qm.Where("id = ?", u))
|
||||
var result *postgres.Trade
|
||||
result, err = query.One(context.TODO(), database.DB.SQL)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user