Skip to content

Commit

Permalink
Have spanDB be a reference (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
XDoubleU authored Jan 5, 2025
1 parent 25dc759 commit f649a83
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/database/postgres/spandb.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ type SpanDB struct {
dbName string
}

// NewSpanDB creates a new [SpanDB].
func NewSpanDB(db DB) SpanDB {
return SpanDB{
// NewSpanDB creates a new [*SpanDB].
func NewSpanDB(db DB) *SpanDB {
return &SpanDB{
DB: db,
dbName: "postgresql",
}
}

// Exec is used to wrap Exec in a [sentry.Span].
func (db SpanDB) Exec(
func (db *SpanDB) Exec(
ctx context.Context,
sql string,
arguments ...any,
Expand All @@ -32,7 +32,7 @@ func (db SpanDB) Exec(
}

// Query is used to wrap Query in a [sentry.Span].
func (db SpanDB) Query(
func (db *SpanDB) Query(
ctx context.Context,
sql string,
optionsAndArgs ...any,
Expand All @@ -41,7 +41,7 @@ func (db SpanDB) Query(
}

// QueryRow is used to wrap QueryRow in a [sentry.Span].
func (db SpanDB) QueryRow(
func (db *SpanDB) QueryRow(
ctx context.Context,
sql string,
optionsAndArgs ...any,
Expand All @@ -56,12 +56,12 @@ func (db SpanDB) QueryRow(

// Begin doesn't wrap Begin in a [sentry.Span] as
// this makes little sense for starting a transaction.
func (db SpanDB) Begin(ctx context.Context) (pgx.Tx, error) {
func (db *SpanDB) Begin(ctx context.Context) (pgx.Tx, error) {
return db.DB.Begin(ctx)
}

// Ping doesn't wrap Ping in a [sentry.Span] as
// this makes little sense for pinging the db.
func (db SpanDB) Ping(ctx context.Context) error {
func (db *SpanDB) Ping(ctx context.Context) error {
return db.DB.Ping(ctx)
}

0 comments on commit f649a83

Please sign in to comment.