From 27f441204af29231bc7b4245d5b3c5b4e9f949ad Mon Sep 17 00:00:00 2001 From: Sergei Loshkarev Date: Thu, 9 Nov 2023 22:23:25 +0300 Subject: [PATCH 1/2] fix Tr interface in sqlx/contract.go (add missing methods of sqlx Tx/DB) --- sqlx/contract.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sqlx/contract.go b/sqlx/contract.go index 9451b90..f7dcaab 100644 --- a/sqlx/contract.go +++ b/sqlx/contract.go @@ -15,18 +15,20 @@ import ( type Tr interface { sqlx.ExtContext + sqlx.Preparer Preparex(query string) (*sqlx.Stmt, error) PreparexContext(ctx context.Context, query string) (*sqlx.Stmt, error) - PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error) PrepareNamed(query string) (*sqlx.NamedStmt, error) + PrepareNamedContext(ctx context.Context, query string) (*sqlx.NamedStmt, error) + sqlx.Execer MustExec(query string, args ...interface{}) sql.Result MustExecContext(ctx context.Context, query string, args ...interface{}) sql.Result - NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error) NamedExec(query string, arg interface{}) (sql.Result, error) + NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error) - Queryx(query string, args ...interface{}) (*sqlx.Rows, error) - QueryRowx(query string, args ...interface{}) *sqlx.Row + sqlx.Queryer + QueryRow(query string, args ...any) *sql.Row QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row NamedQuery(query string, arg interface{}) (*sqlx.Rows, error) From 26828fb3ef429ab305c30d9be6b32e0703e0d8a2 Mon Sep 17 00:00:00 2001 From: Sergei Loshkarev Date: Fri, 10 Nov 2023 00:19:23 +0300 Subject: [PATCH 2/2] fix build-problems --- sqlx/contract.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sqlx/contract.go b/sqlx/contract.go index f7dcaab..1ead0f8 100644 --- a/sqlx/contract.go +++ b/sqlx/contract.go @@ -28,7 +28,7 @@ type Tr interface { NamedExecContext(ctx context.Context, query string, arg interface{}) (sql.Result, error) sqlx.Queryer - QueryRow(query string, args ...any) *sql.Row + QueryRow(query string, args ...interface{}) *sql.Row QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row NamedQuery(query string, arg interface{}) (*sqlx.Rows, error)