Skip to content

Commit 85c4774

Browse files
committed
update README.md
1 parent 41b8fbe commit 85c4774

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,27 @@ Tested MySQL versions for the client include:
197197
- 5.7.x
198198
- 8.0.x
199199

200+
### Example for SELECT streaming (v.1.1.1)
201+
You can use also streaming for large SELECT responses.
202+
The callback function will be called for every result row without storing the whole resultset in memory.
203+
`result.Fields` will be filled before the first callback call.
204+
205+
```go
206+
// ...
207+
var result mysql.Result
208+
err := conn.ExecuteSelectStreaming(`select id, name from table LIMIT 100500`, &result, func(row []mysql.FieldValue) error {
209+
for idx, val := range row {
210+
field := result.Fields[idx]
211+
// You must not save FieldValue.AsString() value after this callback is done.
212+
// Copy it if you need.
213+
// ...
214+
}
215+
return false, nil
216+
})
217+
218+
// ...
219+
```
220+
200221
## Server
201222

202223
Server package supplies a framework to implement a simple MySQL server which can handle the packets from the MySQL client.

0 commit comments

Comments
 (0)