You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-1Lines changed: 20 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,7 +129,7 @@ Cursors have a number of methods available for accessing the query results
129
129
-`All` retrieves all documents from the result set into the provided slice.
130
130
-`One` retrieves the first document from the result se.
131
131
132
-
Example:
132
+
Examples:
133
133
134
134
```go
135
135
varrowinterface{}
@@ -141,6 +141,25 @@ if res.Err() != nil {
141
141
}
142
142
```
143
143
144
+
```go
145
+
varrows []interface{}
146
+
err:= res.All(&rows)
147
+
if err != nil {
148
+
// error
149
+
}
150
+
```
151
+
152
+
```go
153
+
varrowinterface{}
154
+
err:= res.One(&row)
155
+
if err == r.ErrEmptyResult {
156
+
// row not found
157
+
}
158
+
if err != nil {
159
+
// error
160
+
}
161
+
```
162
+
144
163
## Encoding/Decoding Structs
145
164
When passing structs to Expr(And functions that use Expr such as Insert, Update) the structs are encoded into a map before being sent to the server. Each exported field is added to the map unless
0 commit comments