-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package client_test | ||
|
||
import ( | ||
"github.com/go-mysql-org/go-mysql/client" | ||
"github.com/go-mysql-org/go-mysql/mysql" | ||
) | ||
|
||
var ( | ||
conn *client.Conn | ||
) | ||
|
||
func ExampleConn_ExecuteMultiple() { | ||
queries := "SELECT 1; SELECT NOW();" | ||
conn.ExecuteMultiple(queries, func(result *mysql.Result, err error) { | ||
// Use the result as you want | ||
}) | ||
} | ||
|
||
func ExampleConn_ExecuteSelectStreaming() { | ||
var result mysql.Result | ||
conn.ExecuteSelectStreaming(`SELECT ... LIMIT 100500`, &result, func(row []mysql.FieldValue) error { | ||
// Use the row as you want. | ||
// You must not save FieldValue.AsString() value after this callback is done. Copy it if you need. | ||
return nil | ||
}, nil) | ||
} |