type Stmt
The following table describes type Stmt.
Method |
Description |
Return Value |
(s *Stmt)Close() |
Closes a specified prepared statement. |
error |
(s *Stmt)Exec(args ...interface{}) |
Executes a prepared statement with specified parameters and returns a Result value. |
Result and error |
(s *Stmt)ExecContext(ctx context.Context, args ...interface{}) |
Executes a prepared statement with specified parameters in a specified context and returns a Result value. |
Result and error |
(s *Stmt)Query(args ...interface{}) |
Executes a prepared statement with specified parameters and returns *Rows as the query result. |
*Rows and error |
(s *Stmt)QueryContext(ctx context.Context, args ...interface{}) |
Executes a prepared statement with specified parameters in a specified context and returns *Rows as the query result. |
*Rows and error |
(s *Stmt)QueryRow(args ...interface{}) |
Executes a prepared statement with specified parameters and returns *Row as the result. |
*Row |
(s *Stmt)QueryRowContext (ctx context.Context, args ...interface{}) |
Executes a prepared statement with specified parameters in a specified context and returns *Row as the result. |
*Row |
Parameters
Parameter |
Description |
ctx |
Specified context |
query |
Executed SQL statement |
args |
Parameter that needs to be bound to the executed SQL statement. Binding by location and binding by name are supported. For details, see the example in type DB. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.