/ Code generated by sqlc. DO NOT EDIT.
package db
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, // here the error is being displayed
}
}
错误
不能使用 tx(*sql.Tx 类型的变量)作为结构文字中的 DBTX 值:方法 ExecContext 的类型错误(具有 func(ctx context.Context,查询字符串,args ...接口{})(数据库/sql.Result , error), want func(context.Context, string, ...interface{}) (database/sql.Result, error)) compilerInvalidIfaceAssign