Skip to content

Commit

Permalink
feat: prepare_stmt support ping (#6924)
Browse files Browse the repository at this point in the history
* feat: prepare_stmt support ping

* feat: prepare_stmt tx support ping
  • Loading branch information
philhuan authored Mar 28, 2024
1 parent 26195e6 commit 1b48aa0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions prepare_stmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ func (db *PreparedStmtDB) QueryRowContext(ctx context.Context, query string, arg
return &sql.Row{}
}

func (db *PreparedStmtDB) Ping() error {
conn, err := db.GetDBConn()
if err != nil {
return err
}
return conn.Ping()
}

type PreparedStmtTX struct {
Tx
PreparedStmtDB *PreparedStmtDB
Expand Down Expand Up @@ -242,3 +250,11 @@ func (tx *PreparedStmtTX) QueryRowContext(ctx context.Context, query string, arg
}
return &sql.Row{}
}

func (tx *PreparedStmtTX) Ping() error {
conn, err := tx.GetDBConn()
if err != nil {
return err
}
return conn.Ping()
}

0 comments on commit 1b48aa0

Please sign in to comment.