| 1 | package rethinkdbscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ |
| 2 | |
| 3 | import ( |
| 4 | "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/" |
| 5 | "reflectscip-go gomod github.com/golang/go/src go1.14 reflect/" |
| 6 | "strconvscip-go gomod github.com/golang/go/src go1.14 strconv/" |
| 7 | "stringsscip-go gomod github.com/golang/go/src go1.14 strings/" |
| 8 | |
| 9 | "golang.org/x/net/contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/" |
| 10 | pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/ "gopkg.in/rethinkdb/rethinkdb-go.v6/ql2scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/" |
| 11 | ) |
| 12 | |
| 13 | // A Query represents a query ready to be sent to the database, A Query differs |
| 14 | // from a Term as it contains both a query type and token. These values are used |
| 15 | // by the database to determine if the query is continuing a previous request |
| 16 | // and also allows the driver to identify the response as they can come out of |
| 17 | // order. |
| 18 | type Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query# struct { |
| 19 | Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_QueryTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_QueryType# |
| 20 | Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token. int64 |
| 21 | Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term. *Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# |
| 22 | Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts. map[string]interface{} |
| 23 | builtTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#builtTerm. interface{} |
| 24 | } |
| 25 | |
| 26 | func (q *Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Build().() []interface{} { |
| 27 | res := []interface{}{int(q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type.)} |
| 28 | if q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term. != nil { |
| 29 | res = append(res, q.builtTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#builtTerm.) |
| 30 | } |
| 31 | |
| 32 | if len(q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.) > 0 { |
| 33 | // Clone opts and remove custom rethinkdb options |
| 34 | opts := map[string]interface{}{} |
| 35 | for k, v := range q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts. { |
| 36 | switch k { |
| 37 | case "geometry_format": |
| 38 | default: |
| 39 | opts[k] = v |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | res = append(res, opts) |
| 44 | } |
| 45 | |
| 46 | return res |
| 47 | } |
| 48 | |
| 49 | type termsListscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/termsList# []Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# |
| 50 | type termsObjscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/termsObj# map[string]Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# |
| 51 | |
| 52 | // A Term represents a query that is being built. Terms consist of a an array of |
| 53 | // "sub-terms" and a term type. When a Term is a sub-term the first element of |
| 54 | // the terms data is its parent Term. |
| 55 | // |
| 56 | // When built the term becomes a JSON array, for more information on the format |
| 57 | // see http://rethinkdb.com/docs/writing-drivers/. |
| 58 | type Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# struct { |
| 59 | namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#name. string |
| 60 | rawQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rawQuery. bool |
| 61 | rootTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rootTerm. bool |
| 62 | termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_TermTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_TermType# |
| 63 | datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data. interface{} |
| 64 | argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. []Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# |
| 65 | optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs. map[string]Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# |
| 66 | lastErrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#lastErr. error |
| 67 | isMockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#isMockAnything. bool |
| 68 | } |
| 69 | |
| 70 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) comparescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#compare().(t2 Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#, varMap map[int64]int64) bool { |
| 71 | if t.isMockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#isMockAnything. || t2.isMockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#isMockAnything. { |
| 72 | return true |
| 73 | } |
| 74 | |
| 75 | if t.namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#name. != t2.namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#name. || |
| 76 | t.rawQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rawQuery. != t2.rawQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rawQuery. || |
| 77 | t.rootTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rootTerm. != t2.rootTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rootTerm. || |
| 78 | t.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. != t2.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. || |
| 79 | !reflectscip-go gomod github.com/golang/go/src go1.14 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.14 reflect/DeepEqual().(t.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data., t2.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data.) || |
| 80 | len(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.) != len(t2.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.) || |
| 81 | len(t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.) != len(t2.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.) { |
| 82 | return false |
| 83 | } |
| 84 | |
| 85 | for i, v := range t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. { |
| 86 | if t.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_FUNCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_FUNC. && t2.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_FUNCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_FUNC. && i == 0 { |
| 87 | // Functions need to be compared differently as each variable |
| 88 | // will have a different var ID so first try to create a mapping |
| 89 | // between the two sets of IDs |
| 90 | argsArr := t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[0].argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. |
| 91 | argsArr2 := t2.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[0].argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. |
| 92 | |
| 93 | if len(argsArr) != len(argsArr2) { |
| 94 | return false |
| 95 | } |
| 96 | |
| 97 | for j := 0; j < len(argsArr); j++ { |
| 98 | varMap[argsArr[j].datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data..(int64)] = argsArr2[j].datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data..(int64) |
| 99 | } |
| 100 | } else if t.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_VARscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_VAR. && t2.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_VARscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_VAR. && i == 0 { |
| 101 | // When comparing vars use our var map |
| 102 | v1 := t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[i].datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data..(int64) |
| 103 | v2 := t2.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[i].datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data..(int64) |
| 104 | |
| 105 | if varMap[v1] != v2 { |
| 106 | return false |
| 107 | } |
| 108 | } else if !v.comparescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#compare().(t2.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[i], varMap) { |
| 109 | return false |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | for k, v := range t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs. { |
| 114 | if _, ok := t2.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.[k]; !ok { |
| 115 | return false |
| 116 | } |
| 117 | |
| 118 | if !v.comparescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#compare().(t2.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.[k], varMap) { |
| 119 | return false |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | return true |
| 124 | } |
| 125 | |
| 126 | // build takes the query tree and prepares it to be sent as a JSON |
| 127 | // expression |
| 128 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Build().() (interface{}, error) { |
| 129 | var err error |
| 130 | |
| 131 | if t.lastErrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#lastErr. != nil { |
| 132 | return nil, t.lastErrscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#lastErr. |
| 133 | } |
| 134 | |
| 135 | if t.rawQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rawQuery. { |
| 136 | return t.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data., nil |
| 137 | } |
| 138 | |
| 139 | switch t.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. { |
| 140 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_DATUMscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_DATUM.: |
| 141 | return t.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data., nil |
| 142 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_MAKE_OBJscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_MAKE_OBJ.: |
| 143 | res := map[string]interface{}{} |
| 144 | for k, v := range t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs. { |
| 145 | res[k], err = v.Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Build().() |
| 146 | if err != nil { |
| 147 | return nil, err |
| 148 | } |
| 149 | } |
| 150 | return res, nil |
| 151 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_BINARYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_BINARY.: |
| 152 | if len(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.) == 0 { |
| 153 | return map[string]interface{}{ |
| 154 | "$reql_type$": "BINARY", |
| 155 | "data": t.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data., |
| 156 | }, nil |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | args := make([]interface{}, len(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.)) |
| 161 | optArgs := make(map[string]interface{}, len(t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.)) |
| 162 | |
| 163 | for i, v := range t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. { |
| 164 | arg, err := v.Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Build().() |
| 165 | if err != nil { |
| 166 | return nil, err |
| 167 | } |
| 168 | args[i] = arg |
| 169 | } |
| 170 | |
| 171 | for k, v := range t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs. { |
| 172 | optArgs[k], err = v.Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Build().() |
| 173 | if err != nil { |
| 174 | return nil, err |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | ret := []interface{}{int(t.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType.)} |
| 179 | |
| 180 | if len(args) > 0 { |
| 181 | ret = append(ret, args) |
| 182 | } |
| 183 | if len(optArgs) > 0 { |
| 184 | ret = append(ret, optArgs) |
| 185 | } |
| 186 | |
| 187 | return ret, nil |
| 188 | } |
| 189 | |
| 190 | // String returns a string representation of the query tree |
| 191 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().() string { |
| 192 | if t.isMockAnythingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#isMockAnything. { |
| 193 | return "r.MockAnything()" |
| 194 | } |
| 195 | |
| 196 | switch t.termTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#termType. { |
| 197 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_MAKE_ARRAYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_MAKE_ARRAY.: |
| 198 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("[%s]", stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Joinscip-go gomod github.com/golang/go/src go1.14 strings/Join().(argsToStringSlicescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/argsToStringSlice().(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.), ", ")) |
| 199 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_MAKE_OBJscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_MAKE_OBJ.: |
| 200 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("{%s}", stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Joinscip-go gomod github.com/golang/go/src go1.14 strings/Join().(optArgsToStringSlicescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/optArgsToStringSlice().(t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.), ", ")) |
| 201 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_FUNCscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_FUNC.: |
| 202 | // Get string representation of each argument |
| 203 | args := []string{} |
| 204 | for _, v := range t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[0].argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. { |
| 205 | args = append(args, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("var_%d", v.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data.)) |
| 206 | } |
| 207 | |
| 208 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("func(%s r.Term) r.Term { return %s }", |
| 209 | stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Joinscip-go gomod github.com/golang/go/src go1.14 strings/Join().(args, ", "), |
| 210 | t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[1].Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().(), |
| 211 | ) |
| 212 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_VARscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_VAR.: |
| 213 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("var_%s", t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[0]) |
| 214 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_IMPLICIT_VARscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_IMPLICIT_VAR.: |
| 215 | return "r.Row" |
| 216 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_DATUMscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_DATUM.: |
| 217 | switch v := t.datascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#data..(type) { |
| 218 | case string: |
| 219 | return strconvscip-go gomod github.com/golang/go/src go1.14 strconv/.Quotescip-go gomod github.com/golang/go/src go1.14 strconv/Quote().(v) |
| 220 | default: |
| 221 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("%v", v) |
| 222 | } |
| 223 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Term_BINARYscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Term_BINARY.: |
| 224 | if len(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.) == 0 { |
| 225 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("r.binary(<data>)") |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | if t.rootTermscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#rootTerm. { |
| 230 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("r.%s(%s)", t.namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#name., stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Joinscip-go gomod github.com/golang/go/src go1.14 strings/Join().(allArgsToStringSlicescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/allArgsToStringSlice().(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args., t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.), ", ")) |
| 231 | } |
| 232 | |
| 233 | if t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args. == nil { |
| 234 | return "r" |
| 235 | } |
| 236 | |
| 237 | return fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("%s.%s(%s)", t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[0].Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().(), t.namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#name., stringsscip-go gomod github.com/golang/go/src go1.14 strings/.Joinscip-go gomod github.com/golang/go/src go1.14 strings/Join().(allArgsToStringSlicescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/allArgsToStringSlice().(t.argsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#args.[1:], t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs.), ", ")) |
| 238 | } |
| 239 | |
| 240 | // OptArgs is an interface used to represent a terms optional arguments. All |
| 241 | // optional argument types have a toMap function, the returned map can be encoded |
| 242 | // and sent as part of the query. |
| 243 | type OptArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/OptArgs# interface { |
| 244 | toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/OptArgs#toMap.() map[string]interface{} |
| 245 | } |
| 246 | |
| 247 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) OptArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#OptArgs().(args interface{}) Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term# { |
| 248 | switch args := args.(type) { |
| 249 | case OptArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/OptArgs#: |
| 250 | t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs. = convertTermObjscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/convertTermObj().(args.toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/OptArgs#toMap.()) |
| 251 | case map[string]interface{}: |
| 252 | t.optArgsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#optArgs. = convertTermObjscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/convertTermObj().(args) |
| 253 | } |
| 254 | |
| 255 | return t |
| 256 | } |
| 257 | |
| 258 | type QueryExecutorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor# interface { |
| 259 | IsConnectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#IsConnected.() bool |
| 260 | Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#Query.(contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) (*Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) |
| 261 | Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#Exec.(contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) error |
| 262 | |
| 263 | newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#newQuery.(t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#, opts map[string]interface{}) (Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#, error) |
| 264 | } |
| 265 | |
| 266 | // WriteResponse is a helper type used when dealing with the response of a |
| 267 | // write query. It is also returned by the RunWrite function. |
| 268 | type WriteResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse# struct { |
| 269 | Errorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Errors. int `rethinkdb:"errors"` |
| 270 | Insertedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Inserted. int `rethinkdb:"inserted"` |
| 271 | Updatedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Updated. int `rethinkdb:"updated"` |
| 272 | Unchangedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Unchanged. int `rethinkdb:"unchanged"` |
| 273 | Replacedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Replaced. int `rethinkdb:"replaced"` |
| 274 | Renamedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Renamed. int `rethinkdb:"renamed"` |
| 275 | Skippedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Skipped. int `rethinkdb:"skipped"` |
| 276 | Deletedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Deleted. int `rethinkdb:"deleted"` |
| 277 | Createdscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Created. int `rethinkdb:"created"` |
| 278 | DBsCreatedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#DBsCreated. int `rethinkdb:"dbs_created"` |
| 279 | TablesCreatedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#TablesCreated. int `rethinkdb:"tables_created"` |
| 280 | Droppedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Dropped. int `rethinkdb:"dropped"` |
| 281 | DBsDroppedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#DBsDropped. int `rethinkdb:"dbs_dropped"` |
| 282 | TablesDroppedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#TablesDropped. int `rethinkdb:"tables_dropped"` |
| 283 | GeneratedKeysscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#GeneratedKeys. []string `rethinkdb:"generated_keys"` |
| 284 | FirstErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#FirstError. string `rethinkdb:"first_error"` // populated if Errors > 0 |
| 285 | ConfigChangesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#ConfigChanges. []ChangeResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse# `rethinkdb:"config_changes"` |
| 286 | Changesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Changes. []ChangeResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse# |
| 287 | } |
| 288 | |
| 289 | // ChangeResponse is a helper type used when dealing with changefeeds. The type |
| 290 | // contains both the value before the query and the new value. |
| 291 | type ChangeResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse# struct { |
| 292 | NewValuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#NewValue. interface{} `rethinkdb:"new_val,omitempty"` |
| 293 | OldValuescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#OldValue. interface{} `rethinkdb:"old_val,omitempty"` |
| 294 | Statescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#State. string `rethinkdb:"state,omitempty"` |
| 295 | Errorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#Error. string `rethinkdb:"error,omitempty"` |
| 296 | Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#Type. string `rethinkdb:"type,omitempty"` |
| 297 | OldOffsetscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#OldOffset. int `rethinkdb:"old_offset,omitempty"` |
| 298 | NewOffsetscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ChangeResponse#NewOffset. int `rethinkdb:"new_offset,omitempty"` |
| 299 | } |
| 300 | |
| 301 | // RunOpts contains the optional arguments for the Run function. |
| 302 | type RunOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts# struct { |
| 303 | DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#DB. interface{} `rethinkdb:"db,omitempty"` |
| 304 | Dbscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#Db. interface{} `rethinkdb:"db,omitempty"` // Deprecated |
| 305 | Profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#Profile. interface{} `rethinkdb:"profile,omitempty"` |
| 306 | Durabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#Durability. interface{} `rethinkdb:"durability,omitempty"` |
| 307 | UseOutdatedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#UseOutdated. interface{} `rethinkdb:"use_outdated,omitempty"` // Deprecated |
| 308 | ArrayLimitscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#ArrayLimit. interface{} `rethinkdb:"array_limit,omitempty"` |
| 309 | TimeFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#TimeFormat. interface{} `rethinkdb:"time_format,omitempty"` |
| 310 | GroupFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#GroupFormat. interface{} `rethinkdb:"group_format,omitempty"` |
| 311 | BinaryFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#BinaryFormat. interface{} `rethinkdb:"binary_format,omitempty"` |
| 312 | GeometryFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#GeometryFormat. interface{} `rethinkdb:"geometry_format,omitempty"` |
| 313 | ReadModescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#ReadMode. interface{} `rethinkdb:"read_mode,omitempty"` |
| 314 | |
| 315 | MinBatchRowsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#MinBatchRows. interface{} `rethinkdb:"min_batch_rows,omitempty"` |
| 316 | MaxBatchRowsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#MaxBatchRows. interface{} `rethinkdb:"max_batch_rows,omitempty"` |
| 317 | MaxBatchBytesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#MaxBatchBytes. interface{} `rethinkdb:"max_batch_bytes,omitempty"` |
| 318 | MaxBatchSecondsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#MaxBatchSeconds. interface{} `rethinkdb:"max_batch_seconds,omitempty"` |
| 319 | FirstBatchScaledownFactorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#FirstBatchScaledownFactor. interface{} `rethinkdb:"first_batch_scaledown_factor,omitempty"` |
| 320 | |
| 321 | Contextscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#Context. contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context# `rethinkdb:"-"` |
| 322 | } |
| 323 | |
| 324 | func (o RunOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#) toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#toMap().() map[string]interface{} { |
| 325 | return optArgsToMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/optArgsToMap().(o) |
| 326 | } |
| 327 | |
| 328 | // Run runs a query using the given connection. |
| 329 | // |
| 330 | // rows, err := query.Run(sess) |
| 331 | // if err != nil { |
| 332 | // // error |
| 333 | // } |
| 334 | // |
| 335 | // var doc MyDocumentType |
| 336 | // for rows.Next(&doc) { |
| 337 | // // Do something with document |
| 338 | // } |
| 339 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(s QueryExecutorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#, optArgs ...RunOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#) (*Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 340 | opts := map[string]interface{}{} |
| 341 | var ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context# = nil // if it's nil connection will form context from connection opts |
| 342 | if len(optArgs) >= 1 { |
| 343 | opts = optArgs[0].toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#toMap().() |
| 344 | ctx = optArgs[0].Contextscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#Context. |
| 345 | } |
| 346 | |
| 347 | if s == nil || !s.IsConnectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#IsConnected.() { |
| 348 | return nil, ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed. |
| 349 | } |
| 350 | |
| 351 | q, err := s.newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#newQuery.(t, opts) |
| 352 | if err != nil { |
| 353 | return nil, err |
| 354 | } |
| 355 | |
| 356 | return s.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#Query.(ctx, q) |
| 357 | } |
| 358 | |
| 359 | // RunWrite runs a query using the given connection but unlike Run automatically |
| 360 | // scans the result into a variable of type WriteResponse. This function should be used |
| 361 | // if you are running a write query (such as Insert, Update, TableCreate, etc...). |
| 362 | // |
| 363 | // If an error occurs when running the write query the first error is returned. |
| 364 | // |
| 365 | // res, err := r.DB("database").Table("table").Insert(doc).RunWrite(sess) |
| 366 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) RunWritescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#RunWrite().(s QueryExecutorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#, optArgs ...RunOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#) (WriteResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#, error) { |
| 367 | var response WriteResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse# |
| 368 | |
| 369 | res, err := t.Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(s, optArgs...) |
| 370 | if err != nil { |
| 371 | return response, err |
| 372 | } |
| 373 | defer res.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().() |
| 374 | |
| 375 | if err = res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&response); err != nil { |
| 376 | return response, err |
| 377 | } |
| 378 | |
| 379 | if response.Errorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#Errors. > 0 { |
| 380 | return response, fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.14 fmt/Errorf().("%s", response.FirstErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/WriteResponse#FirstError.) |
| 381 | } |
| 382 | |
| 383 | return response, nil |
| 384 | } |
| 385 | |
| 386 | // ReadOne is a shortcut method that runs the query on the given connection |
| 387 | // and reads one response from the cursor before closing it. |
| 388 | // |
| 389 | // It returns any errors encountered from running the query or reading the response |
| 390 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) ReadOnescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#ReadOne().(dest interface{}, s QueryExecutorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#, optArgs ...RunOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#) error { |
| 391 | res, err := t.Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(s, optArgs...) |
| 392 | if err != nil { |
| 393 | return err |
| 394 | } |
| 395 | return res.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(dest) |
| 396 | } |
| 397 | |
| 398 | // ReadAll is a shortcut method that runs the query on the given connection |
| 399 | // and reads all of the responses from the cursor before closing it. |
| 400 | // |
| 401 | // It returns any errors encountered from running the query or reading the responses |
| 402 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) ReadAllscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#ReadAll().(dest interface{}, s QueryExecutorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#, optArgs ...RunOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RunOpts#) error { |
| 403 | res, err := t.Runscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Run().(s, optArgs...) |
| 404 | if err != nil { |
| 405 | return err |
| 406 | } |
| 407 | return res.Allscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#All().(dest) |
| 408 | } |
| 409 | |
| 410 | // ExecOpts contains the optional arguments for the Exec function and inherits |
| 411 | // its options from RunOpts, the only difference is the addition of the NoReply |
| 412 | // field. |
| 413 | // |
| 414 | // When NoReply is true it causes the driver not to wait to receive the result |
| 415 | // and return immediately. |
| 416 | type ExecOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts# struct { |
| 417 | DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#DB. interface{} `rethinkdb:"db,omitempty"` |
| 418 | Dbscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#Db. interface{} `rethinkdb:"db,omitempty"` // Deprecated |
| 419 | Profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#Profile. interface{} `rethinkdb:"profile,omitempty"` |
| 420 | Durabilityscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#Durability. interface{} `rethinkdb:"durability,omitempty"` |
| 421 | UseOutdatedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#UseOutdated. interface{} `rethinkdb:"use_outdated,omitempty"` // Deprecated |
| 422 | ArrayLimitscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#ArrayLimit. interface{} `rethinkdb:"array_limit,omitempty"` |
| 423 | TimeFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#TimeFormat. interface{} `rethinkdb:"time_format,omitempty"` |
| 424 | GroupFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#GroupFormat. interface{} `rethinkdb:"group_format,omitempty"` |
| 425 | BinaryFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#BinaryFormat. interface{} `rethinkdb:"binary_format,omitempty"` |
| 426 | GeometryFormatscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#GeometryFormat. interface{} `rethinkdb:"geometry_format,omitempty"` |
| 427 | |
| 428 | MinBatchRowsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#MinBatchRows. interface{} `rethinkdb:"min_batch_rows,omitempty"` |
| 429 | MaxBatchRowsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#MaxBatchRows. interface{} `rethinkdb:"max_batch_rows,omitempty"` |
| 430 | MaxBatchBytesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#MaxBatchBytes. interface{} `rethinkdb:"max_batch_bytes,omitempty"` |
| 431 | MaxBatchSecondsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#MaxBatchSeconds. interface{} `rethinkdb:"max_batch_seconds,omitempty"` |
| 432 | FirstBatchScaledownFactorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#FirstBatchScaledownFactor. interface{} `rethinkdb:"first_batch_scaledown_factor,omitempty"` |
| 433 | |
| 434 | NoReplyscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#NoReply. interface{} `rethinkdb:"noreply,omitempty"` |
| 435 | |
| 436 | Contextscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#Context. contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context# `rethinkdb:"-"` |
| 437 | } |
| 438 | |
| 439 | func (o ExecOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#) toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#toMap().() map[string]interface{} { |
| 440 | return optArgsToMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/optArgsToMap().(o) |
| 441 | } |
| 442 | |
| 443 | // Exec runs the query but does not return the result. Exec will still wait for |
| 444 | // the response to be received unless the NoReply field is true. |
| 445 | // |
| 446 | // err := r.DB("database").Table("table").Insert(doc).Exec(sess, r.ExecOpts{ |
| 447 | // NoReply: true, |
| 448 | // }) |
| 449 | func (t Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#) Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Exec().(s QueryExecutorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#, optArgs ...ExecOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#) error { |
| 450 | opts := map[string]interface{}{} |
| 451 | var ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context# = nil // if it's nil connection will form context from connection opts |
| 452 | if len(optArgs) >= 1 { |
| 453 | opts = optArgs[0].toMapscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#toMap().() |
| 454 | ctx = optArgs[0].Contextscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ExecOpts#Context. |
| 455 | } |
| 456 | |
| 457 | if s == nil || !s.IsConnectedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#IsConnected.() { |
| 458 | return ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed. |
| 459 | } |
| 460 | |
| 461 | q, err := s.newQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#newQuery.(t, opts) |
| 462 | if err != nil { |
| 463 | return err |
| 464 | } |
| 465 | |
| 466 | return s.Execscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/QueryExecutor#Exec.(ctx, q) |
| 467 | } |