Debian Codegraph @

internal/integration/tests/example_query_select_test.go

raw symbols SCIP
1 package testsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/
2
3 import (
4 "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/"
5 rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ "gopkg.in/rethinkdb/rethinkdb-go.v6scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/"
6 )
7
8 // Find a document by ID.
9 func ExampleTerm_Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Get().() {
10 // Fetch the row from the database
11 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("heroes").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().(2).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
12 if err != nil {
13 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
14 return
15 }
16 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
17
18 if res.IsNilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#IsNil().() {
19 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().("Row not found")
20 return
21 }
22
23 var hero map[string]interface{}
24 err = res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&hero)
25 if err != nil {
26 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
27 return
28 }
29 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(hero["name"])
30
31 // Output: Superman
32 }
33
34 // Find a document by ID.
35 func ExampleTerm_GetAllscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_GetAll().() {
36 // Fetch the row from the database
37 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("heroes").GetAllscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#GetAll().(2).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
38 if err != nil {
39 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
40 return
41 }
42 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
43
44 if res.IsNilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#IsNil().() {
45 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().("Row not found")
46 return
47 }
48
49 var hero map[string]interface{}
50 err = res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&hero)
51 if err != nil {
52 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
53 return
54 }
55 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(hero["name"])
56
57 // Output: Superman
58 }
59
60 // Find a document by ID.
61 func ExampleTerm_GetAll_multiplescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_GetAll_multiple().() {
62 // Fetch the row from the database
63 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("heroes").GetAllscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#GetAll().(1, 2).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
64 if err != nil {
65 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
66 return
67 }
68 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
69
70 var heroes []map[string]interface{}
71 err = res.Allscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#All().(&heroes)
72 if err != nil {
73 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
74 return
75 }
76 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(heroes[0]["name"])
77
78 // Output: Superman
79 }
80
81 // Find all document with an indexed value.
82 func ExampleTerm_GetAll_optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_GetAll_optArgs().() {
83 // Fetch the row from the database
84 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("heroes").GetAllscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#GetAll().("man_of_steel").OptArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#OptArgs().(rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.GetAllOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/GetAllOpts#{
85 Indexscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/GetAllOpts#Index.: "code_name",
86 }).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
87 if err != nil {
88 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
89 return
90 }
91 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
92
93 if res.IsNilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#IsNil().() {
94 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().("Row not found")
95 return
96 }
97
98 var hero map[string]interface{}
99 err = res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&hero)
100 if err != nil {
101 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
102 return
103 }
104 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(hero["name"])
105
106 // Output: Superman
107 }
108
109 // Find all document with an indexed value.
110 func ExampleTerm_GetAllByIndexscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_GetAllByIndex().() {
111 // Fetch the row from the database
112 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("heroes").GetAllByIndexscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#GetAllByIndex().("code_name", "man_of_steel").Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
113 if err != nil {
114 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
115 return
116 }
117 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
118
119 if res.IsNilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#IsNil().() {
120 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().("Row not found")
121 return
122 }
123
124 var hero map[string]interface{}
125 err = res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&hero)
126 if err != nil {
127 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
128 return
129 }
130 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(hero["name"])
131
132 // Output: Superman
133 }
134
135 // Find a document and merge another document with it.
136 func ExampleTerm_Get_mergescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Get_merge().() {
137 // Fetch the row from the database
138 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("heroes").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().(4).Mergescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Merge().(map[string]interface{}{
139 "powers": []string{"speed"},
140 }).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
141 if err != nil {
142 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
143 return
144 }
145 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
146
147 if res.IsNilscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#IsNil().() {
148 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().("Row not found")
149 return
150 }
151
152 var hero map[string]interface{}
153 err = res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&hero)
154 if err != nil {
155 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
156 return
157 }
158 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%s: %v", hero["name"], hero["powers"])
159
160 // Output: The Flash: [speed]
161 }
162
163 // Get all users who are 30 years old.
164 func ExampleTerm_Filterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Filter().() {
165 // Fetch the row from the database
166 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("users").Filterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Filter().(map[string]interface{}{
167 "age": 30,
168 }).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
169 if err != nil {
170 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
171 return
172 }
173 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
174
175 // Scan query result into the person variable
176 var users []interface{}
177 err = res.Allscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#All().(&users)
178 if err != nil {
179 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
180 return
181 }
182 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d users", len(users))
183
184 // Output: 2 users
185 }
186
187 // Get all users who are more than 25 years old.
188 func ExampleTerm_Filter_rowscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Filter_row().() {
189 // Fetch the row from the database
190 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("users").Filterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Filter().(rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.Rowscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Row..Fieldscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Field().("age").Gtscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Gt().(25)).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
191 if err != nil {
192 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
193 return
194 }
195 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
196
197 // Scan query result into the person variable
198 var users []interface{}
199 err = res.Allscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#All().(&users)
200 if err != nil {
201 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
202 return
203 }
204 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d users", len(users))
205
206 // Output: 3 users
207 }
208
209 // Retrieve all users who have a gmail account (whose field email ends with @gmail.com).
210 func ExampleTerm_Filter_functionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Filter_function().() {
211 // Fetch the row from the database
212 res, err := rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().("examples").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("users").Filterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Filter().(func(user rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# {
213 return user.Fieldscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Field().("email").Matchscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Match().("@gmail.com$")
214 }).Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
215 if err != nil {
216 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
217 return
218 }
219 defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().()
220
221 // Scan query result into the person variable
222 var users []interface{}
223 err = res.Allscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#All().(&users)
224 if err != nil {
225 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("Error scanning database result: %s", err)
226 return
227 }
228 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d users", len(users))
229
230 // Output: 1 users
231 }