Skip to content

Commit

Permalink
feat: use sqlx instead of sql
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM authored and MonikaCat committed Jan 19, 2024
1 parent 2823c29 commit 801eac1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion database/legacy/v3/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ type Migrator struct {

func NewMigrator(db *postgresql.Database) *Migrator {
return &Migrator{
SQL: sqlx.NewDb(db.SQL, "postgres"),
SQL: db.SQL,
}
}
6 changes: 4 additions & 2 deletions database/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"strings"

"github.com/jmoiron/sqlx"

"github.com/forbole/juno/v3/logging"

"github.com/cosmos/cosmos-sdk/simapp/params"
Expand Down Expand Up @@ -39,7 +41,7 @@ func Builder(ctx *database.Context) (database.Database, error) {
connStr += fmt.Sprintf(" password=%s", ctx.Cfg.Password)
}

postgresDb, err := sql.Open("postgres", connStr)
postgresDb, err := sqlx.Open("postgres", connStr)
if err != nil {
return nil, err
}
Expand All @@ -61,7 +63,7 @@ var _ database.Database = &Database{}
// Database defines a wrapper around a SQL database and implements functionality
// for data aggregation and exporting.
type Database struct {
SQL *sql.DB
SQL *sqlx.DB
EncodingConfig *params.EncodingConfig
Logger logging.Logger
}
Expand Down

0 comments on commit 801eac1

Please sign in to comment.