-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is an error when implementing the type DBTX interface (SQLC code generator) with the pgsql driver pinpoint plugin #11
Comments
i got same issue |
how to query using func QueryContext with argument? |
The code that solved the problem was committed to the main branch, and the problem you mentioned do not occur when I test. I think you tested it with the previously released version. Check if you tested it with the main branch. Or maybe it's because of the go runtime version, but I tested it at 1.18.4. What version did you use? |
I used go 19 version, and i'm still strugling with this errors :D it's my code, if you can correct my code ` import (
) const queryG = "select func main() {
} func query(w http.ResponseWriter, r *http.Request) {
} and my pinpoint-go-agent version is v0.5.1 |
There is no problem when I test the go 19 version. Please refer to the link below and test it with the main branch. |
it's solved, thank you for yout advice |
Code overview :
// load DB
import (
"database/sql"
"fmt"
"net/url"
"time"
_ "github.com/pinpoint-apm/pinpoint-go-agent/plugin/pgsql" // use wrapped postgres driver
)
func (conf DBConf) loadDB() *sql.DB {
newDB, err := sql.Open("pq-pinpoint", connectionString)
return newDB
}
`// Code generated by sqlc. DO NOT EDIT.
package postgres
import (
"context"
"database/sql"
)
type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}
func New(db DBTX) *Queries {
return &Queries{db: db}
}
type Queries struct {
db DBTX
}
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
return &Queries{
db: tx,
}
}
func (q *Queries) QueryGetTbGuestById(ctx context.Context, id string) (TbTransactionDelivery, error) {
row := q.db.QueryRowContext(ctx, queryGetTbGuestById, id)
var i TbTransactionDelivery
err := row.Scan(
&i.Id,
&i.Name,
)
return i, err
}
`
Error :
interface conversion: *pq.conn is not driver.NamedValueChecker: missing method CheckNamedValue"
The text was updated successfully, but these errors were encountered: