Linter configuration and linting.
This commit is contained in:
@@ -41,9 +41,7 @@ func Initialize(app *application.Application) error {
|
||||
}
|
||||
|
||||
func (d *database) Configure() error {
|
||||
if err := d.configureDBPath(); err != nil {
|
||||
return fmt.Errorf("configure: %w", err)
|
||||
}
|
||||
d.configureDBPath()
|
||||
|
||||
db, err := sqlx.Open("sqlite", d.dbPath)
|
||||
if err != nil {
|
||||
|
@@ -4,10 +4,8 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func (d *database) configureDBPath() error {
|
||||
func (d *database) configureDBPath() {
|
||||
d.dbPath = filepath.Join(d.app.Fyne().Storage().RootURI().Path(), "database.sqlite3")
|
||||
|
||||
d.logger.Info("Database path configured.", "path", d.dbPath)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ func (d *database) Exec(ctx context.Context, query string, params ...interface{}
|
||||
query = d.db.Rebind(query)
|
||||
}
|
||||
|
||||
d.logger.Debug("Executing query.", "query", query, "params", fmt.Sprintf("%+v", params), "module", "core/database")
|
||||
d.logger.Debug("Executing query.", "query", query, "params", fmt.Sprintf("%+v", params))
|
||||
|
||||
if _, err := d.db.ExecContext(ctx, query, params...); err != nil {
|
||||
return fmt.Errorf("%w: failed to Exec(): %w", core.ErrDatabase, err)
|
||||
@@ -29,12 +29,7 @@ func (d *database) Get(ctx context.Context, target interface{}, query string, pa
|
||||
query = d.db.Rebind(query)
|
||||
}
|
||||
|
||||
d.logger.Debug(
|
||||
"Getting single data from database with query.",
|
||||
"query", query,
|
||||
"params", fmt.Sprintf("%+v", params),
|
||||
"module", "core/database",
|
||||
)
|
||||
d.logger.Debug("Getting single data from database with query.", "query", query, "params", fmt.Sprintf("%+v", params))
|
||||
|
||||
if err := d.db.GetContext(ctx, target, query, params...); err != nil {
|
||||
return fmt.Errorf("%w: failed to Get(): %w", core.ErrDatabase, err)
|
||||
@@ -49,7 +44,7 @@ func (d *database) NamedExec(ctx context.Context, query string, param interface{
|
||||
query = d.db.Rebind(query)
|
||||
}
|
||||
|
||||
d.logger.Debug("Executing named query.", "query", query, "params", fmt.Sprintf("%+v", param), "module", "core/database")
|
||||
d.logger.Debug("Executing named query.", "query", query, "params", fmt.Sprintf("%+v", param))
|
||||
|
||||
if _, err := d.db.NamedExecContext(ctx, query, param); err != nil {
|
||||
return fmt.Errorf("%w: failed to NamedExec(): %w", core.ErrDatabase, err)
|
||||
@@ -64,12 +59,7 @@ func (d *database) Select(ctx context.Context, target interface{}, query string,
|
||||
query = d.db.Rebind(query)
|
||||
}
|
||||
|
||||
d.logger.Debug(
|
||||
"Selecting from database with query.",
|
||||
"query", query,
|
||||
"params", fmt.Sprintf("%+v", params),
|
||||
"module", "core/database",
|
||||
)
|
||||
d.logger.Debug("Selecting from database with query.", "query", query, "params", fmt.Sprintf("%+v", params))
|
||||
|
||||
if err := d.db.SelectContext(ctx, target, query, params...); err != nil {
|
||||
return fmt.Errorf("%w: failed to Select(): %w", core.ErrDatabase, err)
|
||||
|
Reference in New Issue
Block a user