Stmtx returns a version of the prepared statement which runs within a transaction. Provided stmt can be either *sql.Stmt or *sqlx.Stmt.
(stmt interface{})
| 472 | // Stmtx returns a version of the prepared statement which runs within a transaction. Provided |
| 473 | // stmt can be either *sql.Stmt or *sqlx.Stmt. |
| 474 | func (tx *Tx) Stmtx(stmt interface{}) *Stmt { |
| 475 | var s *sql.Stmt |
| 476 | switch v := stmt.(type) { |
| 477 | case Stmt: |
| 478 | s = v.Stmt |
| 479 | case *Stmt: |
| 480 | s = v.Stmt |
| 481 | case *sql.Stmt: |
| 482 | s = v |
| 483 | default: |
| 484 | panic(fmt.Sprintf("non-statement type %v passed to Stmtx", reflect.ValueOf(stmt).Type())) |
| 485 | } |
| 486 | return &Stmt{Stmt: tx.Stmt(s), Mapper: tx.Mapper} |
| 487 | } |
| 488 | |
| 489 | // NamedStmt returns a version of the prepared statement which runs within a transaction. |
| 490 | func (tx *Tx) NamedStmt(stmt *NamedStmt) *NamedStmt { |
no outgoing calls