Skip to content

Commit

Permalink
Merge pull request #94 from honeycombio/paul.fix-tests
Browse files Browse the repository at this point in the history
Add context methods to DB. Fixes pop example.
  • Loading branch information
Paul Osman authored Feb 19, 2020
2 parents 4aaac62 + 3892674 commit 29f9024
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions wrappers/hnypop/pop.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package hnypop

import (
"context"
"database/sql"
"math/rand"

Expand Down Expand Up @@ -48,3 +49,25 @@ func (m *DB) Commit() error {
func (m *DB) Close() error {
return m.Close()
}
func (m *DB) SelectContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error {
return m.DB.SelectContext(ctx, dest, query, args...)
}
func (m *DB) GetContext(ctx context.Context, dest interface{}, query string, args ...interface{}) error {
return m.DB.GetContext(ctx, dest, query, args...)
}
func (m *DB) NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error) {
return m.DB.NamedExecContext(ctx, query, arg)
}
func (m *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
return m.DB.ExecContext(ctx, query, args...)
}
func (m *DB) PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error) {
p, err := m.DB.PrepareNamedContext(ctx, query)
if err != nil {
return nil, err
}
return p.GetWrappedNamedStmt(), err
}
func (m *DB) TransactionContext(ctx context.Context) (*pop.Tx, error) {
return m.tx.TransactionContext(ctx)
}

0 comments on commit 29f9024

Please sign in to comment.