Debian Codegraph @

internal/integration/tests/example_query_write_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 // Insert a document into the table posts using a struct.
9 func ExampleTerm_Insert_structscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Insert_struct().() {
10 type Post struct {
11 ID int `rethinkdb:"id"`
12 Title string `rethinkdb:"title"`
13 Content string `rethinkdb:"content"`
14 }
15
16 resp, 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().("posts").Insertscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Insert().(Post{
17 ID: 1,
18 Title: "Lorem ipsum",
19 Content: "Dolor sit amet",
20 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
21 if err != nil {
22 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
23 return
24 }
25
26 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row inserted", resp.Insertedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Inserted.)
27
28 // Output:
29 // 1 row inserted
30 }
31
32 // Insert a document without a defined primary key into the table posts where
33 // the primary key is id.
34 func ExampleTerm_Insert_generatedKeyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Insert_generatedKey().() {
35 type Post struct {
36 Title string `rethinkdb:"title"`
37 Content string `rethinkdb:"content"`
38 }
39
40 resp, 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().("posts").Insertscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Insert().(map[string]interface{}{
41 "title": "Lorem ipsum",
42 "content": "Dolor sit amet",
43 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
44 if err != nil {
45 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
46 return
47 }
48
49 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row inserted, %d key generated", resp.Insertedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Inserted., len(resp.GeneratedKeysscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#GeneratedKeys.))
50
51 // Output:
52 // 1 row inserted, 1 key generated
53 }
54
55 // Insert a document into the table posts using a map.
56 func ExampleTerm_Insert_mapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Insert_map().() {
57 resp, 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().("posts").Insertscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Insert().(map[string]interface{}{
58 "id": 2,
59 "title": "Lorem ipsum",
60 "content": "Dolor sit amet",
61 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
62 if err != nil {
63 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
64 return
65 }
66
67 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row inserted", resp.Insertedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Inserted.)
68
69 // Output:
70 // 1 row inserted
71 }
72
73 // Insert multiple documents into the table posts.
74 func ExampleTerm_Insert_multiplescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Insert_multiple().() {
75 resp, 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().("posts").Insertscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Insert().([]interface{}{
76 map[string]interface{}{
77 "title": "Lorem ipsum",
78 "content": "Dolor sit amet",
79 },
80 map[string]interface{}{
81 "title": "Lorem ipsum",
82 "content": "Dolor sit amet",
83 },
84 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
85 if err != nil {
86 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
87 return
88 }
89
90 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d rows inserted", resp.Insertedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Inserted.)
91
92 // Output:
93 // 2 rows inserted
94 }
95
96 // Insert a document into the table posts, replacing the document if it already
97 // exists.
98 func ExampleTerm_Insert_upsertscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Insert_upsert().() {
99 resp, 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().("posts").Insertscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Insert().(map[string]interface{}{
100 "id": 1,
101 "title": "Lorem ipsum 2",
102 }, rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.InsertOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/InsertOpts#{
103 Conflictscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/InsertOpts#Conflict.: "replace",
104 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
105 if err != nil {
106 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
107 return
108 }
109
110 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row replaced", resp.Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced.)
111
112 // Output:
113 // 1 row replaced
114 }
115
116 // Update the status of the post with id of 1 to published.
117 func ExampleTerm_Updatescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Update().() {
118 resp, 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().("posts").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().(2).Updatescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Update().(map[string]interface{}{
119 "status": "published",
120 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
121 if err != nil {
122 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
123 return
124 }
125
126 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row replaced", resp.Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced.)
127
128 // Output:
129 // 1 row replaced
130 }
131
132 // Update bob's cell phone number.
133 func ExampleTerm_Update_nestedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Update_nested().() {
134 resp, 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").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().("bob").Updatescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Update().(map[string]interface{}{
135 "contact": map[string]interface{}{
136 "phone": "408-555-4242",
137 },
138 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
139 if err != nil {
140 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
141 return
142 }
143
144 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row replaced", resp.Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced.)
145
146 // Output:
147 // 1 row replaced
148 }
149
150 // Update the status of all posts to published.
151 func ExampleTerm_Update_allscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Update_all().() {
152 resp, 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().("posts").Updatescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Update().(map[string]interface{}{
153 "status": "published",
154 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
155 if err != nil {
156 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
157 return
158 }
159
160 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row replaced", resp.Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced.)
161
162 // Output:
163 // 4 row replaced
164 }
165
166 // Increment the field view of the post with id of 1. If the field views does not
167 // exist, it will be set to 0.
168 func ExampleTerm_Update_incrementscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Update_increment().() {
169 resp, 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().("posts").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().(1).Updatescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Update().(map[string]interface{}{
170 "views": 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().("views").Addscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Add().(1).Defaultscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Default().(0),
171 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
172 if err != nil {
173 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
174 return
175 }
176
177 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row replaced", resp.Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced.)
178
179 // Output:
180 // 1 row replaced
181 }
182
183 // Update the status of the post with id of 1 using soft durability.
184 func ExampleTerm_Update_softDurabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Update_softDurability().() {
185 resp, 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().("posts").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().(2).Updatescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Update().(map[string]interface{}{
186 "status": "draft",
187 }, rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.UpdateOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/UpdateOpts#{
188 Durabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/UpdateOpts#Durability.: "soft",
189 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
190 if err != nil {
191 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
192 return
193 }
194
195 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row replaced", resp.Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced.)
196
197 // Output:
198 // 1 row replaced
199 }
200
201 // Delete a single document from the table posts.
202 func ExampleTerm_Deletescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Delete().() {
203 resp, 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().("posts").Getscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Get().(2).Deletescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Delete().().RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
204 if err != nil {
205 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
206 return
207 }
208
209 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d row deleted", resp.Deletedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Deleted.)
210
211 // Output:
212 // 1 row deleted
213 }
214
215 // Delete all comments where the field status is published
216 func ExampleTerm_Delete_manyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_Delete_many().() {
217 resp, 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().("posts").Filterscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Filter().(map[string]interface{}{
218 "status": "published",
219 }).Deletescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Delete().().RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
220 if err != nil {
221 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
222 return
223 }
224
225 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d rows deleted", resp.Deletedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Deleted.)
226
227 // Output:
228 // 4 rows deleted
229 }
230
231 func ExampleTerm_SetWriteHookscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/ExampleTerm_SetWriteHook().() {
232 resp, 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().("test").Tablescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Table().("test").SetWriteHookscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#SetWriteHook().(
233 func(id 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#, oldVal 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#, newVal 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# {
234 return rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.Branchscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Branch().(oldVal.Andscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#And().(newVal),
235 newVal.Mergescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Merge().(map[string]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#{"write_counter": oldVal.Fieldscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Field().("write_counter").Addscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Add().(1)}),
236 newVal,
237 newVal.Mergescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Merge().(rscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/.Exprscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Expr().(map[string]int{"write_counter": 1})),
238 nil,
239 )
240 }).RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(sessionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/internal/integration/tests`/session.)
241
242 if err != nil {
243 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printscip-go gomod github.com/golang/go/src go1.14 fmt/Print().(err)
244 return
245 }
246
247 fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Printfscip-go gomod github.com/golang/go/src go1.14 fmt/Printf().("%d hook created", resp.Createdscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Created.)
248 // Output:
249 // 1 hook created
250 }