ql2/opt/rustwide/target/x86_64-unknown-linux-gnu/debug/build/ql2-f9a894c61df6d5f9/out/ql2.rs
1/// We need to wrap it like this for some
2#[derive(serde::Serialize, serde::Deserialize)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct VersionDummy {
5}
6/// Nested message and enum types in `VersionDummy`.
7pub mod version_dummy {
8 /// non-conforming protobuf libraries
9 /// This enum contains the magic numbers for your version. See **THE HIGH-LEVEL
10 /// VIEW** for what to do with it.
11 #[derive(serde::Serialize, serde::Deserialize)]
12 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
13 #[repr(i32)]
14 pub enum Version {
15 V01 = 1063369270,
16 /// Authorization key during handshake
17 V02 = 1915781601,
18 /// Authorization key and protocol during handshake
19 V03 = 1601562686,
20 /// Queries execute in parallel
21 V04 = 1074539808,
22 /// Users and permissions
23 V10 = 885177795,
24 }
25 /// The protocol to use after the handshake, specified in V0_3
26 #[derive(serde::Serialize, serde::Deserialize)]
27 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
28 #[repr(i32)]
29 pub enum Protocol {
30 Protobuf = 656407617,
31 Json = 2120839367,
32 }
33}
34/// You send one of:
35/// * A \[START\] query with a \[Term\] to evaluate and a unique-per-connection token.
36/// * A \[CONTINUE\] query with the same token as a \[START\] query that returned
37/// \[SUCCESS_PARTIAL\] in its \[Response\].
38/// * A \[STOP\] query with the same token as a \[START\] query that you want to stop.
39/// * A \[NOREPLY_WAIT\] query with a unique per-connection token. The server answers
40/// with a \[WAIT_COMPLETE\] \[Response\].
41/// * A \[SERVER_INFO\] query. The server answers with a \[SERVER_INFO\] \[Response\].
42#[derive(serde::Serialize, serde::Deserialize)]
43#[derive(Clone, PartialEq, ::prost::Message)]
44pub struct Query {
45 #[prost(enumeration="query::QueryType", optional, tag="1")]
46 pub r#type: ::core::option::Option<i32>,
47 /// A \[Term\] is how we represent the operations we want a query to perform.
48 ///
49 /// only present when \[type\] = \[START\]
50 #[prost(message, optional, tag="2")]
51 pub query: ::core::option::Option<Term>,
52 #[prost(int64, optional, tag="3")]
53 pub token: ::core::option::Option<i64>,
54 /// This flag is ignored on the server. `noreply` should be added
55 /// to `global_optargs` instead (the key "noreply" should map to
56 /// either true or false).
57 #[prost(bool, optional, tag="4", default="false")]
58 pub obsolete_noreply: ::core::option::Option<bool>,
59 /// If this is set to \[true\], then \[Datum\] values will sometimes be
60 /// of \[DatumType\] \[R_JSON\] (see below). This can provide enormous
61 /// speedups in languages with poor protobuf libraries.
62 #[prost(bool, optional, tag="5", default="false")]
63 pub accepts_r_json: ::core::option::Option<bool>,
64 #[prost(message, repeated, tag="6")]
65 pub global_optargs: ::prost::alloc::vec::Vec<query::AssocPair>,
66}
67/// Nested message and enum types in `Query`.
68pub mod query {
69 #[derive(serde::Serialize, serde::Deserialize)]
70 #[derive(Clone, PartialEq, ::prost::Message)]
71 pub struct AssocPair {
72 #[prost(string, optional, tag="1")]
73 pub key: ::core::option::Option<::prost::alloc::string::String>,
74 #[prost(message, optional, tag="2")]
75 pub val: ::core::option::Option<super::Term>,
76 }
77 #[derive(serde::Serialize, serde::Deserialize)]
78 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
79 #[repr(i32)]
80 pub enum QueryType {
81 /// Start a new query.
82 Start = 1,
83 /// Continue a query that returned \[SUCCESS_PARTIAL\]
84 Continue = 2,
85 /// (see \[Response\]).
86 ///
87 /// Stop a query partway through executing.
88 Stop = 3,
89 /// Wait for noreply operations to finish.
90 NoreplyWait = 4,
91 /// Get server information.
92 ServerInfo = 5,
93 }
94}
95/// A backtrace frame (see `backtrace` in Response below)
96#[derive(serde::Serialize, serde::Deserialize)]
97#[derive(Clone, PartialEq, ::prost::Message)]
98pub struct Frame {
99 #[prost(enumeration="frame::FrameType", optional, tag="1")]
100 pub r#type: ::core::option::Option<i32>,
101 /// The index of the positional argument.
102 #[prost(int64, optional, tag="2")]
103 pub pos: ::core::option::Option<i64>,
104 /// The name of the optional argument.
105 #[prost(string, optional, tag="3")]
106 pub opt: ::core::option::Option<::prost::alloc::string::String>,
107}
108/// Nested message and enum types in `Frame`.
109pub mod frame {
110 #[derive(serde::Serialize, serde::Deserialize)]
111 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
112 #[repr(i32)]
113 pub enum FrameType {
114 /// Error occurred in a positional argument.
115 Pos = 1,
116 /// Error occurred in an optional argument.
117 Opt = 2,
118 }
119}
120#[derive(serde::Serialize, serde::Deserialize)]
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct Backtrace {
123 #[prost(message, repeated, tag="1")]
124 pub frames: ::prost::alloc::vec::Vec<Frame>,
125}
126/// You get back a response with the same \[token\] as your query.
127#[derive(serde::Serialize, serde::Deserialize)]
128#[derive(Clone, PartialEq, ::prost::Message)]
129pub struct Response {
130 #[prost(enumeration="response::ResponseType", optional, tag="1")]
131 pub r#type: ::core::option::Option<i32>,
132 #[prost(enumeration="response::ErrorType", optional, tag="7")]
133 pub error_type: ::core::option::Option<i32>,
134 #[prost(enumeration="response::ResponseNote", repeated, packed="false", tag="6")]
135 pub notes: ::prost::alloc::vec::Vec<i32>,
136 /// Indicates what \[Query\] this response corresponds to.
137 #[prost(int64, optional, tag="2")]
138 pub token: ::core::option::Option<i64>,
139 /// \[response\] contains 1 RQL datum if \[type\] is \[SUCCESS_ATOM\] or
140 /// \[SERVER_INFO\]. \[response\] contains many RQL data if \[type\] is
141 /// \[SUCCESS_SEQUENCE\] or \[SUCCESS_PARTIAL\]. \[response\] contains 1
142 /// error message (of type \[R_STR\]) in all other cases.
143 #[prost(message, repeated, tag="3")]
144 pub response: ::prost::alloc::vec::Vec<Datum>,
145 /// If \[type\] is \[CLIENT_ERROR\], \[TYPE_ERROR\], or \[RUNTIME_ERROR\], then a
146 /// backtrace will be provided. The backtrace says where in the query the
147 /// error occurred. Ideally this information will be presented to the user as
148 /// a pretty-printed version of their query with the erroneous section
149 /// underlined. A backtrace is a series of 0 or more \[Frame\]s, each of which
150 /// specifies either the index of a positional argument or the name of an
151 /// optional argument. (Those words will make more sense if you look at the
152 /// \[Term\] message below.)
153 ///
154 /// Contains n \[Frame\]s when you get back an error.
155 #[prost(message, optional, tag="4")]
156 pub backtrace: ::core::option::Option<Backtrace>,
157 /// If the \[global_optargs\] in the \[Query\] that this \[Response\] is a
158 /// response to contains a key "profile" which maps to a static value of
159 /// true then \[profile\] will contain a \[Datum\] which provides profiling
160 /// information about the execution of the query. This field should be
161 /// returned to the user along with the result that would normally be
162 /// returned (a datum or a cursor). In official drivers this is accomplished
163 /// by putting them inside of an object with "value" mapping to the return
164 /// value and "profile" mapping to the profile object.
165 #[prost(message, optional, tag="5")]
166 pub profile: ::core::option::Option<Datum>,
167}
168/// Nested message and enum types in `Response`.
169pub mod response {
170 #[derive(serde::Serialize, serde::Deserialize)]
171 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
172 #[repr(i32)]
173 pub enum ResponseType {
174 /// These response types indicate success.
175 ///
176 /// Query returned a single RQL datatype.
177 SuccessAtom = 1,
178 /// Query returned a sequence of RQL datatypes.
179 SuccessSequence = 2,
180 /// Query returned a partial sequence of RQL
181 SuccessPartial = 3,
182 /// datatypes. If you send a \[CONTINUE\] query with
183 /// the same token as this response, you will get
184 /// more of the sequence. Keep sending \[CONTINUE\]
185 /// queries until you get back \[SUCCESS_SEQUENCE\].
186 ///
187 /// A \[NOREPLY_WAIT\] query completed.
188 WaitComplete = 4,
189 /// The data for a \[SERVER_INFO\] request. This is
190 ServerInfo = 5,
191 // the same as `SUCCESS_ATOM` except that there will
192 // never be profiling data.
193
194 /// These response types indicate failure.
195 ///
196 /// Means the client is buggy. An example is if the
197 ClientError = 16,
198 /// client sends a malformed protobuf, or tries to
199 /// send \[CONTINUE\] for an unknown token.
200 ///
201 /// Means the query failed during parsing or type
202 CompileError = 17,
203 /// checking. For example, if you pass too many
204 /// arguments to a function.
205 ///
206 /// Means the query failed at runtime. An example is
207 RuntimeError = 18,
208 }
209 /// If `ResponseType` is `RUNTIME_ERROR`, this may be filled in with more
210 /// information about the error.
211 #[derive(serde::Serialize, serde::Deserialize)]
212 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
213 #[repr(i32)]
214 pub enum ErrorType {
215 Internal = 1000000,
216 ResourceLimit = 2000000,
217 QueryLogic = 3000000,
218 NonExistence = 3100000,
219 OpFailed = 4100000,
220 OpIndeterminate = 4200000,
221 User = 5000000,
222 PermissionError = 6000000,
223 }
224 /// ResponseNotes are used to provide information about the query
225 /// response that may be useful for people writing drivers or ORMs.
226 /// Currently all the notes we send indicate that a stream has certain
227 /// special properties.
228 #[derive(serde::Serialize, serde::Deserialize)]
229 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
230 #[repr(i32)]
231 pub enum ResponseNote {
232 /// The stream is a changefeed stream (e.g. `r.table('test').changes()`).
233 SequenceFeed = 1,
234 /// The stream is a point changefeed stream
235 /// (e.g. `r.table('test').get(0).changes()`).
236 AtomFeed = 2,
237 /// The stream is an order_by_limit changefeed stream
238 /// (e.g. `r.table('test').order_by(index: 'id').limit(5).changes()`).
239 OrderByLimitFeed = 3,
240 /// The stream is a union of multiple changefeed types that can't be
241 /// collapsed to a single type
242 /// (e.g. `r.table('test').changes().union(r.table('test').get(0).changes())`).
243 UnionedFeed = 4,
244 /// The stream is a changefeed stream and includes notes on what state
245 /// the changefeed stream is in (e.g. objects of the form `{state:
246 /// 'initializing'}`).
247 IncludesStates = 5,
248 }
249}
250/// A \[Datum\] is a chunk of data that can be serialized to disk or returned to
251/// the user in a Response. Currently we only support JSON types, but we may
252/// support other types in the future (e.g., a date type or an integer type).
253#[derive(serde::Serialize, serde::Deserialize)]
254#[derive(Clone, PartialEq, ::prost::Message)]
255pub struct Datum {
256 #[prost(enumeration="datum::DatumType", optional, tag="1")]
257 pub r#type: ::core::option::Option<i32>,
258 #[prost(bool, optional, tag="2")]
259 pub r_bool: ::core::option::Option<bool>,
260 #[prost(double, optional, tag="3")]
261 pub r_num: ::core::option::Option<f64>,
262 #[prost(string, optional, tag="4")]
263 pub r_str: ::core::option::Option<::prost::alloc::string::String>,
264 #[prost(message, repeated, tag="5")]
265 pub r_array: ::prost::alloc::vec::Vec<Datum>,
266 #[prost(message, repeated, tag="6")]
267 pub r_object: ::prost::alloc::vec::Vec<datum::AssocPair>,
268}
269/// Nested message and enum types in `Datum`.
270pub mod datum {
271 #[derive(serde::Serialize, serde::Deserialize)]
272 #[derive(Clone, PartialEq, ::prost::Message)]
273 pub struct AssocPair {
274 #[prost(string, optional, tag="1")]
275 pub key: ::core::option::Option<::prost::alloc::string::String>,
276 #[prost(message, optional, tag="2")]
277 pub val: ::core::option::Option<super::Datum>,
278 }
279 #[derive(serde::Serialize, serde::Deserialize)]
280 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
281 #[repr(i32)]
282 pub enum DatumType {
283 RNull = 1,
284 RBool = 2,
285 /// a double
286 RNum = 3,
287 RStr = 4,
288 RArray = 5,
289 RObject = 6,
290 /// This \[DatumType\] will only be used if \[accepts_r_json\] is
291 /// set to \[true\] in \[Query\]. \[r_str\] will be filled with a
292 /// JSON encoding of the \[Datum\].
293 ///
294 /// uses r_str
295 RJson = 7,
296 }
297}
298/// A \[Term\] is either a piece of data (see **Datum** above), or an operator and
299/// its operands. If you have a \[Datum\], it's stored in the member \[datum\]. If
300/// you have an operator, its positional arguments are stored in \[args\] and its
301/// optional arguments are stored in \[optargs\].
302///
303/// A note about type signatures:
304/// We use the following notation to denote types:
305/// arg1_type, arg2_type, argrest_type... -> result_type
306/// So, for example, if we have a function `avg` that takes any number of
307/// arguments and averages them, we might write:
308/// NUMBER... -> NUMBER
309/// Or if we had a function that took one number modulo another:
310/// NUMBER, NUMBER -> NUMBER
311/// Or a function that takes a table and a primary key of any Datum type, then
312/// retrieves the entry with that primary key:
313/// Table, DATUM -> OBJECT
314/// Some arguments must be provided as literal values (and not the results of sub
315/// terms). These are marked with a `!`.
316/// Optional arguments are specified within curly braces as argname `:` value
317/// type (e.x `{noreply:BOOL}`)
318/// Many RQL operations are polymorphic. For these, alterantive type signatures
319/// are separated by `|`.
320///
321/// The RQL type hierarchy is as follows:
322/// Top
323/// DATUM
324/// NULL
325/// BOOL
326/// NUMBER
327/// STRING
328/// OBJECT
329/// SingleSelection
330/// ARRAY
331/// Sequence
332/// ARRAY
333/// Stream
334/// StreamSelection
335/// Table
336/// Database
337/// Function
338/// Ordering - used only by ORDER_BY
339/// Pathspec -- an object, string, or array that specifies a path
340/// Error
341#[derive(serde::Serialize, serde::Deserialize)]
342#[derive(Clone, PartialEq, ::prost::Message)]
343pub struct Term {
344 #[prost(enumeration="term::TermType", optional, tag="1")]
345 pub r#type: ::core::option::Option<i32>,
346 /// This is only used when type is DATUM.
347 #[prost(message, optional, tag="2")]
348 pub datum: ::core::option::Option<Datum>,
349 /// Holds the positional arguments of the query.
350 #[prost(message, repeated, tag="3")]
351 pub args: ::prost::alloc::vec::Vec<Term>,
352 /// Holds the optional arguments of the query.
353 #[prost(message, repeated, tag="4")]
354 pub optargs: ::prost::alloc::vec::Vec<term::AssocPair>,
355}
356/// Nested message and enum types in `Term`.
357pub mod term {
358 #[derive(serde::Serialize, serde::Deserialize)]
359 #[derive(Clone, PartialEq, ::prost::Message)]
360 pub struct AssocPair {
361 #[prost(string, optional, tag="1")]
362 pub key: ::core::option::Option<::prost::alloc::string::String>,
363 #[prost(message, optional, tag="2")]
364 pub val: ::core::option::Option<super::Term>,
365 }
366 #[derive(serde::Serialize, serde::Deserialize)]
367 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
368 #[repr(i32)]
369 pub enum TermType {
370 /// A RQL datum, stored in `datum` below.
371 Datum = 1,
372 /// DATUM... -> ARRAY
373 MakeArray = 2,
374 /// Evaluate the terms in \[optargs\] and make an object
375 ///
376 /// {...} -> OBJECT
377 MakeObj = 3,
378 // * Compound types
379
380 /// Takes an integer representing a variable and returns the value stored
381 /// in that variable. It's the responsibility of the client to translate
382 /// from their local representation of a variable to a unique _non-negative_
383 /// integer for that variable. (We do it this way instead of letting
384 /// clients provide variable names as strings to discourage
385 /// variable-capturing client libraries, and because it's more efficient
386 /// on the wire.)
387 ///
388 /// !NUMBER -> DATUM
389 Var = 10,
390 /// Takes some javascript code and executes it.
391 ///
392 /// STRING {timeout: !NUMBER} -> DATUM |
393 Javascript = 11,
394 /// STRING {timeout: !NUMBER} -> Function(*)
395 ///
396 /// () -> DATUM
397 Uuid = 169,
398 /// Takes an HTTP URL and gets it. If the get succeeds and
399 /// returns valid JSON, it is converted into a DATUM
400 ///
401 /// STRING {data: OBJECT | STRING,
402 Http = 153,
403 // timeout: !NUMBER,
404 // method: STRING,
405 // params: OBJECT,
406 // header: OBJECT | ARRAY,
407 // attempts: NUMBER,
408 // redirects: NUMBER,
409 // verify: BOOL,
410 // page: FUNC | STRING,
411 // page_limit: NUMBER,
412 // auth: OBJECT,
413 // result_format: STRING,
414 // } -> STRING | STREAM
415
416 /// Takes a string and throws an error with that message.
417 /// Inside of a `default` block, you can omit the first
418 /// argument to rethrow whatever error you catch (this is most
419 /// useful as an argument to the `default` filter optarg).
420 ///
421 /// STRING -> Error | -> Error
422 Error = 12,
423 /// Takes nothing and returns a reference to the implicit variable.
424 ///
425 /// -> DATUM
426 ImplicitVar = 13,
427 /// * Data Operators
428 /// Returns a reference to a database.
429 ///
430 /// STRING -> Database
431 Db = 14,
432 /// Returns a reference to a table.
433 ///
434 /// Database, STRING, {read_mode:STRING, identifier_format:STRING} -> Table
435 Table = 15,
436 /// STRING, {read_mode:STRING, identifier_format:STRING} -> Table
437 /// Gets a single element from a table by its primary or a secondary key.
438 ///
439 /// Table, STRING -> SingleSelection | Table, NUMBER -> SingleSelection |
440 Get = 16,
441 /// Table, STRING -> NULL | Table, NUMBER -> NULL |
442 ///
443 /// Table, DATUM..., {index:!STRING} => ARRAY
444 GetAll = 78,
445 /// Simple DATUM Ops
446 ///
447 /// DATUM... -> BOOL
448 Eq = 17,
449 /// DATUM... -> BOOL
450 Ne = 18,
451 /// DATUM... -> BOOL
452 Lt = 19,
453 /// DATUM... -> BOOL
454 Le = 20,
455 /// DATUM... -> BOOL
456 Gt = 21,
457 /// DATUM... -> BOOL
458 Ge = 22,
459 /// BOOL -> BOOL
460 Not = 23,
461 /// ADD can either add two numbers or concatenate two arrays.
462 ///
463 /// NUMBER... -> NUMBER | STRING... -> STRING
464 Add = 24,
465 /// NUMBER... -> NUMBER
466 Sub = 25,
467 /// NUMBER... -> NUMBER
468 Mul = 26,
469 /// NUMBER... -> NUMBER
470 Div = 27,
471 /// NUMBER, NUMBER -> NUMBER
472 Mod = 28,
473 /// NUMBER -> NUMBER
474 Floor = 183,
475 /// NUMBER -> NUMBER
476 Ceil = 184,
477 /// NUMBER -> NUMBER
478 Round = 185,
479 /// DATUM Array Ops
480 /// Append a single element to the end of an array (like `snoc`).
481 ///
482 /// ARRAY, DATUM -> ARRAY
483 Append = 29,
484 /// Prepend a single element to the end of an array (like `cons`).
485 ///
486 /// ARRAY, DATUM -> ARRAY
487 Prepend = 80,
488 ///Remove the elements of one array from another array.
489 ///
490 /// ARRAY, ARRAY -> ARRAY
491 Difference = 95,
492 /// DATUM Set Ops
493 /// Set ops work on arrays. They don't use actual sets and thus have
494 /// performance characteristics you would expect from arrays rather than
495 /// from sets. All set operations have the post condition that they
496 /// array they return contains no duplicate values.
497 ///
498 /// ARRAY, DATUM -> ARRAY
499 SetInsert = 88,
500 /// ARRAY, ARRAY -> ARRAY
501 SetIntersection = 89,
502 /// ARRAY, ARRAY -> ARRAY
503 SetUnion = 90,
504 /// ARRAY, ARRAY -> ARRAY
505 SetDifference = 91,
506 /// Sequence, NUMBER, NUMBER -> Sequence
507 Slice = 30,
508 /// Sequence, NUMBER -> Sequence
509 Skip = 70,
510 /// Sequence, NUMBER -> Sequence
511 Limit = 71,
512 /// Sequence, DATUM -> Sequence | Sequence, Function(1) -> Sequence
513 OffsetsOf = 87,
514 /// Sequence, (DATUM | Function(1))... -> BOOL
515 Contains = 93,
516 /// Stream/Object Ops
517 /// Get a particular field from an object, or map that over a
518 /// sequence.
519 ///
520 /// OBJECT, STRING -> DATUM
521 GetField = 31,
522 /// | Sequence, STRING -> Sequence
523 /// Return an array containing the keys of the object.
524 ///
525 /// OBJECT -> ARRAY
526 Keys = 94,
527 /// Return an array containing the values of the object.
528 ///
529 /// OBJECT -> ARRAY
530 Values = 186,
531 /// Creates an object
532 ///
533 /// STRING, DATUM, ... -> OBJECT
534 Object = 143,
535 /// Check whether an object contains all the specified fields,
536 /// or filters a sequence so that all objects inside of it
537 /// contain all the specified fields.
538 ///
539 /// OBJECT, Pathspec... -> BOOL
540 HasFields = 32,
541 /// x.with_fields(...) <=> x.has_fields(...).pluck(...)
542 ///
543 /// Sequence, Pathspec... -> Sequence
544 WithFields = 96,
545 /// Get a subset of an object by selecting some attributes to preserve,
546 /// or map that over a sequence. (Both pick and pluck, polymorphic.)
547 ///
548 /// Sequence, Pathspec... -> Sequence | OBJECT, Pathspec... -> OBJECT
549 Pluck = 33,
550 /// Get a subset of an object by selecting some attributes to discard, or
551 /// map that over a sequence. (Both unpick and without, polymorphic.)
552 ///
553 /// Sequence, Pathspec... -> Sequence | OBJECT, Pathspec... -> OBJECT
554 Without = 34,
555 /// Merge objects (right-preferential)
556 ///
557 /// OBJECT... -> OBJECT | Sequence -> Sequence
558 Merge = 35,
559 /// Sequence Ops
560 /// Get all elements of a sequence between two values.
561 /// Half-open by default, but the openness of either side can be
562 /// changed by passing 'closed' or 'open for `right_bound` or
563 /// `left_bound`.
564 ///
565 /// Deprecated version of between, which allows `null` to specify unboundedness
566 BetweenDeprecated = 36,
567 /// With the newer version, clients should use `r.minval` and `r.maxval` for unboundedness
568 ///
569 /// StreamSelection, DATUM, DATUM, {index:!STRING, right_bound:STRING, left_bound:STRING} -> StreamSelection
570 Between = 182,
571 /// Sequence, Function(2) -> DATUM
572 Reduce = 37,
573 /// Sequence, Function(1) -> Sequence
574 Map = 38,
575 // The arity of the function should be
576 // Sequence..., Function(sizeof...(Sequence)) -> Sequence
577
578 /// Sequence, Datum, Function(2), {Function(3), Function(1)
579 Fold = 187,
580 /// Filter a sequence with either a function or a shortcut
581 /// object (see API docs for details). The body of FILTER is
582 /// wrapped in an implicit `.default(false)`, and you can
583 /// change the default value by specifying the `default`
584 /// optarg. If you make the default `r.error`, all errors
585 /// caught by `default` will be rethrown as if the `default`
586 /// did not exist.
587 ///
588 /// Sequence, Function(1), {default:DATUM} -> Sequence |
589 Filter = 39,
590 /// Sequence, OBJECT, {default:DATUM} -> Sequence
591 /// Map a function over a sequence and then concatenate the results together.
592 ///
593 /// Sequence, Function(1) -> Sequence
594 ConcatMap = 40,
595 /// Order a sequence based on one or more attributes.
596 ///
597 /// Sequence, (!STRING | Ordering)..., {index: (!STRING | Ordering)} -> Sequence
598 OrderBy = 41,
599 /// Get all distinct elements of a sequence (like `uniq`).
600 ///
601 /// Sequence -> Sequence
602 Distinct = 42,
603 /// Count the number of elements in a sequence, or only the elements that match
604 /// a given filter.
605 ///
606 /// Sequence -> NUMBER | Sequence, DATUM -> NUMBER | Sequence, Function(1) -> NUMBER
607 Count = 43,
608 /// Sequence -> BOOL
609 IsEmpty = 86,
610 /// Take the union of multiple sequences (preserves duplicate elements! (use distinct)).
611 ///
612 /// Sequence... -> Sequence
613 Union = 44,
614 /// Get the Nth element of a sequence.
615 ///
616 /// Sequence, NUMBER -> DATUM
617 Nth = 45,
618 /// do NTH or GET_FIELD depending on target object
619 ///
620 /// Sequence | OBJECT, NUMBER | STRING -> DATUM
621 Bracket = 170,
622 // OBSOLETE_GROUPED_MAPREDUCE = 46;
623 // OBSOLETE_GROUPBY = 47;
624
625 /// Sequence, Sequence, Function(2) -> Sequence
626 InnerJoin = 48,
627 /// Sequence, Sequence, Function(2) -> Sequence
628 OuterJoin = 49,
629 /// An inner-join that does an equality comparison on two attributes.
630 ///
631 /// Sequence, !STRING, Sequence, {index:!STRING} -> Sequence
632 EqJoin = 50,
633 /// Sequence -> Sequence
634 Zip = 72,
635 /// -> Sequence [0, +inf)
636 Range = 173,
637 // NUMBER -> Sequence [0, a)
638 // NUMBER, NUMBER -> Sequence [a, b)
639
640 /// Array Ops
641 /// Insert an element in to an array at a given index.
642 ///
643 /// ARRAY, NUMBER, DATUM -> ARRAY
644 InsertAt = 82,
645 /// Remove an element at a given index from an array.
646 ///
647 /// ARRAY, NUMBER -> ARRAY |
648 DeleteAt = 83,
649 /// ARRAY, NUMBER, NUMBER -> ARRAY
650 /// Change the element at a given index of an array.
651 ///
652 /// ARRAY, NUMBER, DATUM -> ARRAY
653 ChangeAt = 84,
654 /// Splice one array in to another array.
655 ///
656 /// ARRAY, NUMBER, ARRAY -> ARRAY
657 SpliceAt = 85,
658 /// * Type Ops
659 /// Coerces a datum to a named type (e.g. "bool").
660 /// If you previously used `stream_to_array`, you should use this instead
661 /// with the type "array".
662 ///
663 /// Top, STRING -> Top
664 CoerceTo = 51,
665 /// Returns the named type of a datum (e.g. TYPE_OF(true) = "BOOL")
666 ///
667 /// Top -> STRING
668 TypeOf = 52,
669 /// * Write Ops (the OBJECTs contain data about number of errors etc.)
670 /// Updates all the rows in a selection. Calls its Function with the row
671 /// to be updated, and then merges the result of that call.
672 ///
673 /// StreamSelection, Function(1), {non_atomic:BOOL, durability:STRING, return_changes:BOOL} -> OBJECT |
674 Update = 53,
675 /// SingleSelection, Function(1), {non_atomic:BOOL, durability:STRING, return_changes:BOOL} -> OBJECT |
676 /// StreamSelection, OBJECT, {non_atomic:BOOL, durability:STRING, return_changes:BOOL} -> OBJECT |
677 /// SingleSelection, OBJECT, {non_atomic:BOOL, durability:STRING, return_changes:BOOL} -> OBJECT
678 /// Deletes all the rows in a selection.
679 ///
680 /// StreamSelection, {durability:STRING, return_changes:BOOL} -> OBJECT | SingleSelection -> OBJECT
681 Delete = 54,
682 /// Replaces all the rows in a selection. Calls its Function with the row
683 /// to be replaced, and then discards it and stores the result of that
684 /// call.
685 ///
686 /// StreamSelection, Function(1), {non_atomic:BOOL, durability:STRING, return_changes:BOOL} -> OBJECT | SingleSelection, Function(1), {non_atomic:BOOL, durability:STRING, return_changes:BOOL} -> OBJECT
687 Replace = 55,
688 /// Inserts into a table. If `conflict` is replace, overwrites
689 /// entries with the same primary key. If `conflict` is
690 /// update, does an update on the entry. If `conflict` is
691 /// error, or is omitted, conflicts will trigger an error.
692 ///
693 /// Table, OBJECT, {conflict:STRING, durability:STRING, return_changes:BOOL} -> OBJECT | Table, Sequence, {conflict:STRING, durability:STRING, return_changes:BOOL} -> OBJECT
694 Insert = 56,
695 /// * Administrative OPs
696 /// Creates a database with a particular name.
697 ///
698 /// STRING -> OBJECT
699 DbCreate = 57,
700 /// Drops a database with a particular name.
701 ///
702 /// STRING -> OBJECT
703 DbDrop = 58,
704 /// Lists all the databases by name. (Takes no arguments)
705 ///
706 /// -> ARRAY
707 DbList = 59,
708 /// Creates a table with a particular name in a particular
709 /// database. (You may omit the first argument to use the
710 /// default database.)
711 ///
712 /// Database, STRING, {primary_key:STRING, shards:NUMBER, replicas:NUMBER, primary_replica_tag:STRING} -> OBJECT
713 TableCreate = 60,
714 /// Database, STRING, {primary_key:STRING, shards:NUMBER, replicas:OBJECT, primary_replica_tag:STRING} -> OBJECT
715 /// STRING, {primary_key:STRING, shards:NUMBER, replicas:NUMBER, primary_replica_tag:STRING} -> OBJECT
716 /// STRING, {primary_key:STRING, shards:NUMBER, replicas:OBJECT, primary_replica_tag:STRING} -> OBJECT
717 /// Drops a table with a particular name from a particular
718 /// database. (You may omit the first argument to use the
719 /// default database.)
720 ///
721 /// Database, STRING -> OBJECT
722 TableDrop = 61,
723 /// STRING -> OBJECT
724 /// Lists all the tables in a particular database. (You may
725 /// omit the first argument to use the default database.)
726 ///
727 /// Database -> ARRAY
728 TableList = 62,
729 /// -> ARRAY
730 /// Returns the row in the `rethinkdb.table_config` or `rethinkdb.db_config` table
731 /// that corresponds to the given database or table.
732 ///
733 /// Database -> SingleSelection
734 Config = 174,
735 /// Table -> SingleSelection
736 /// Returns the row in the `rethinkdb.table_status` table that corresponds to the
737 /// given table.
738 ///
739 /// Table -> SingleSelection
740 Status = 175,
741 /// Called on a table, waits for that table to be ready for read/write operations.
742 /// Called on a database, waits for all of the tables in the database to be ready.
743 /// Returns the corresponding row or rows from the `rethinkdb.table_status` table.
744 ///
745 /// Table -> OBJECT
746 Wait = 177,
747 /// Database -> OBJECT
748 /// Generates a new config for the given table, or all tables in the given database
749 /// The `shards` and `replicas` arguments are required. If `emergency_repair` is
750 /// specified, it will enter a completely different mode of repairing a table
751 /// which has lost half or more of its replicas.
752 ///
753 /// Database|Table, {shards:NUMBER, replicas:NUMBER [,
754 Reconfigure = 176,
755 /// dry_run:BOOLEAN]
756 /// } -> OBJECT
757 /// Database|Table, {shards:NUMBER, replicas:OBJECT [,
758 /// primary_replica_tag:STRING,
759 /// nonvoting_replica_tags:ARRAY,
760 /// dry_run:BOOLEAN]
761 /// } -> OBJECT
762 /// Table, {emergency_repair:STRING, dry_run:BOOLEAN} -> OBJECT
763 /// Balances the table's shards but leaves everything else the same. Can also be
764 /// applied to an entire database at once.
765 ///
766 /// Table -> OBJECT
767 Rebalance = 179,
768 // Database -> OBJECT
769
770 /// Ensures that previously issued soft-durability writes are complete and
771 /// written to disk.
772 ///
773 /// Table -> OBJECT
774 Sync = 138,
775 /// Set global, database, or table-specific permissions
776 ///
777 /// -> OBJECT
778 Grant = 188,
779 // Database -> OBJECT
780 // Table -> OBJECT
781
782 /// * Secondary indexes OPs
783 /// Creates a new secondary index with a particular name and definition.
784 ///
785 /// Table, STRING, Function(1), {multi:BOOL} -> OBJECT
786 IndexCreate = 75,
787 /// Drops a secondary index with a particular name from the specified table.
788 ///
789 /// Table, STRING -> OBJECT
790 IndexDrop = 76,
791 /// Lists all secondary indexes on a particular table.
792 ///
793 /// Table -> ARRAY
794 IndexList = 77,
795 /// Gets information about whether or not a set of indexes are ready to
796 /// be accessed. Returns a list of objects that look like this:
797 /// {index:STRING, ready:BOOL[, progress:NUMBER]}
798 ///
799 /// Table, STRING... -> ARRAY
800 IndexStatus = 139,
801 /// Blocks until a set of indexes are ready to be accessed. Returns the
802 /// same values INDEX_STATUS.
803 ///
804 /// Table, STRING... -> ARRAY
805 IndexWait = 140,
806 /// Renames the given index to a new name
807 ///
808 /// Table, STRING, STRING, {overwrite:BOOL} -> OBJECT
809 IndexRename = 156,
810 /// * Write hook Function OPs
811 /// Creates a new write hook function with a particular definition
812 ///
813 /// Table, Function(2)
814 SetWriteHook = 189,
815 /// Gets an existing write hook function on a table
816 ///
817 /// Table
818 GetWriteHook = 190,
819 /// * Control Operators
820 /// Calls a function on data
821 ///
822 /// Function(*), DATUM... -> DATUM
823 Funcall = 64,
824 /// Executes its first argument, and returns its second argument if it
825 /// got \[true\] or its third argument if it got \[false\] (like an `if`
826 /// statement).
827 ///
828 /// BOOL, Top, Top -> Top
829 Branch = 65,
830 /// Returns true if any of its arguments returns true (short-circuits).
831 ///
832 /// BOOL... -> BOOL
833 Or = 66,
834 /// Returns true if all of its arguments return true (short-circuits).
835 ///
836 /// BOOL... -> BOOL
837 And = 67,
838 /// Calls its Function with each entry in the sequence
839 /// and executes the array of terms that Function returns.
840 ///
841 /// Sequence, Function(1) -> OBJECT
842 ForEach = 68,
843 ////////////////////////////////////////////////////////////////////////////////
844 ////////// Special Terms
845 ////////////////////////////////////////////////////////////////////////////////
846
847 /// An anonymous function. Takes an array of numbers representing
848 /// variables (see \[VAR\] above), and a \[Term\] to execute with those in
849 /// scope. Returns a function that may be passed an array of arguments,
850 /// then executes the Term with those bound to the variable names. The
851 /// user will never construct this directly. We use it internally for
852 /// things like `map` which take a function. The "arity" of a \[Function\] is
853 /// the number of arguments it takes.
854 /// For example, here's what `_X_.map{|x| x+2}` turns into:
855 /// Term {
856 /// type = MAP;
857 /// args = [_X_,
858 /// Term {
859 /// type = Function;
860 /// args = [Term {
861 /// type = DATUM;
862 /// datum = Datum {
863 /// type = R_ARRAY;
864 /// r_array = [Datum { type = R_NUM; r_num = 1; }];
865 /// };
866 /// },
867 /// Term {
868 /// type = ADD;
869 /// args = [Term {
870 /// type = VAR;
871 /// args = [Term {
872 /// type = DATUM;
873 /// datum = Datum { type = R_NUM;
874 /// r_num = 1};
875 /// }];
876 /// },
877 /// Term {
878 /// type = DATUM;
879 /// datum = Datum { type = R_NUM; r_num = 2; };
880 /// }];
881 /// }];
882 /// }];
883 ///
884 /// ARRAY, Top -> ARRAY -> Top
885 Func = 69,
886 /// Indicates to ORDER_BY that this attribute is to be sorted in ascending order.
887 ///
888 /// !STRING -> Ordering
889 Asc = 73,
890 /// Indicates to ORDER_BY that this attribute is to be sorted in descending order.
891 ///
892 /// !STRING -> Ordering
893 Desc = 74,
894 /// Gets info about anything. INFO is most commonly called on tables.
895 ///
896 /// Top -> OBJECT
897 Info = 79,
898 /// `a.match(b)` returns a match object if the string `a`
899 /// matches the regular expression `b`.
900 ///
901 /// STRING, STRING -> DATUM
902 Match = 97,
903 /// Change the case of a string.
904 ///
905 /// STRING -> STRING
906 Upcase = 141,
907 /// STRING -> STRING
908 Downcase = 142,
909 /// Select a number of elements from sequence with uniform distribution.
910 ///
911 /// Sequence, NUMBER -> Sequence
912 Sample = 81,
913 /// Evaluates its first argument. If that argument returns
914 /// NULL or throws an error related to the absence of an
915 /// expected value (for instance, accessing a non-existent
916 /// field or adding NULL to an integer), DEFAULT will either
917 /// return its second argument or execute it if it's a
918 /// function. If the second argument is a function, it will be
919 /// passed either the text of the error or NULL as its
920 /// argument.
921 ///
922 /// Top, Top -> Top
923 Default = 92,
924 /// Parses its first argument as a json string and returns it as a
925 /// datum.
926 ///
927 /// STRING -> DATUM
928 Json = 98,
929 /// Parses its first arguments as an ISO 8601 time and returns it as a
930 /// datum.
931 ///
932 /// STRING -> PSEUDOTYPE(TIME)
933 Iso8601 = 99,
934 /// Prints a time as an ISO 8601 time.
935 ///
936 /// PSEUDOTYPE(TIME) -> STRING
937 ToIso8601 = 100,
938 /// Returns a time given seconds since epoch in UTC.
939 ///
940 /// NUMBER -> PSEUDOTYPE(TIME)
941 EpochTime = 101,
942 /// Returns seconds since epoch in UTC given a time.
943 ///
944 /// PSEUDOTYPE(TIME) -> NUMBER
945 ToEpochTime = 102,
946 /// The time the query was received by the server.
947 ///
948 /// -> PSEUDOTYPE(TIME)
949 Now = 103,
950 /// Puts a time into an ISO 8601 timezone.
951 ///
952 /// PSEUDOTYPE(TIME), STRING -> PSEUDOTYPE(TIME)
953 InTimezone = 104,
954 /// a.during(b, c) returns whether a is in the range [b, c)
955 ///
956 /// PSEUDOTYPE(TIME), PSEUDOTYPE(TIME), PSEUDOTYPE(TIME) -> BOOL
957 During = 105,
958 /// Retrieves the date portion of a time.
959 ///
960 /// PSEUDOTYPE(TIME) -> PSEUDOTYPE(TIME)
961 Date = 106,
962 /// x.time_of_day == x.date - x
963 ///
964 /// PSEUDOTYPE(TIME) -> NUMBER
965 TimeOfDay = 126,
966 /// Returns the timezone of a time.
967 ///
968 /// PSEUDOTYPE(TIME) -> STRING
969 Timezone = 127,
970 /// These access the various components of a time.
971 ///
972 /// PSEUDOTYPE(TIME) -> NUMBER
973 Year = 128,
974 /// PSEUDOTYPE(TIME) -> NUMBER
975 Month = 129,
976 /// PSEUDOTYPE(TIME) -> NUMBER
977 Day = 130,
978 /// PSEUDOTYPE(TIME) -> NUMBER
979 DayOfWeek = 131,
980 /// PSEUDOTYPE(TIME) -> NUMBER
981 DayOfYear = 132,
982 /// PSEUDOTYPE(TIME) -> NUMBER
983 Hours = 133,
984 /// PSEUDOTYPE(TIME) -> NUMBER
985 Minutes = 134,
986 /// PSEUDOTYPE(TIME) -> NUMBER
987 Seconds = 135,
988 /// Construct a time from a date and optional timezone or a
989 /// date+time and optional timezone.
990 ///
991 /// NUMBER, NUMBER, NUMBER, STRING -> PSEUDOTYPE(TIME) |
992 Time = 136,
993 // NUMBER, NUMBER, NUMBER, NUMBER, NUMBER, NUMBER, STRING -> PSEUDOTYPE(TIME) |
994
995 /// Constants for ISO 8601 days of the week.
996 ///
997 /// -> 1
998 Monday = 107,
999 /// -> 2
1000 Tuesday = 108,
1001 /// -> 3
1002 Wednesday = 109,
1003 /// -> 4
1004 Thursday = 110,
1005 /// -> 5
1006 Friday = 111,
1007 /// -> 6
1008 Saturday = 112,
1009 /// -> 7
1010 Sunday = 113,
1011 /// Constants for ISO 8601 months.
1012 ///
1013 /// -> 1
1014 January = 114,
1015 /// -> 2
1016 February = 115,
1017 /// -> 3
1018 March = 116,
1019 /// -> 4
1020 April = 117,
1021 /// -> 5
1022 May = 118,
1023 /// -> 6
1024 June = 119,
1025 /// -> 7
1026 July = 120,
1027 /// -> 8
1028 August = 121,
1029 /// -> 9
1030 September = 122,
1031 /// -> 10
1032 October = 123,
1033 /// -> 11
1034 November = 124,
1035 /// -> 12
1036 December = 125,
1037 /// Indicates to MERGE to replace, or remove in case of an empty literal, the
1038 /// other object rather than merge it.
1039 ///
1040 /// -> Merging
1041 Literal = 137,
1042 // JSON -> Merging
1043
1044 /// SEQUENCE, STRING -> GROUPED_SEQUENCE | SEQUENCE, FUNCTION -> GROUPED_SEQUENCE
1045 Group = 144,
1046 Sum = 145,
1047 Avg = 146,
1048 Min = 147,
1049 Max = 148,
1050 /// `str.split()` splits on whitespace
1051 /// `str.split(" ")` splits on spaces only
1052 /// `str.split(" ", 5)` splits on spaces with at most 5 results
1053 /// `str.split(nil, 5)` splits on whitespace with at most 5 results
1054 ///
1055 /// STRING -> ARRAY | STRING, STRING -> ARRAY | STRING, STRING, NUMBER -> ARRAY | STRING, NULL, NUMBER -> ARRAY
1056 Split = 149,
1057 /// GROUPED_DATA -> ARRAY
1058 Ungroup = 150,
1059 /// Takes a range of numbers and returns a random number within the range
1060 ///
1061 /// NUMBER, NUMBER {float:BOOL} -> DATUM
1062 Random = 151,
1063 /// TABLE -> STREAM
1064 Changes = 152,
1065 /// ARRAY -> SPECIAL (used to splice arguments)
1066 Args = 154,
1067 /// BINARY is client-only at the moment, it is not supported on the server
1068 ///
1069 /// STRING -> PSEUDOTYPE(BINARY)
1070 Binary = 155,
1071 /// OBJECT -> PSEUDOTYPE(GEOMETRY)
1072 Geojson = 157,
1073 /// PSEUDOTYPE(GEOMETRY) -> OBJECT
1074 ToGeojson = 158,
1075 /// NUMBER, NUMBER -> PSEUDOTYPE(GEOMETRY)
1076 Point = 159,
1077 /// (ARRAY | PSEUDOTYPE(GEOMETRY))... -> PSEUDOTYPE(GEOMETRY)
1078 Line = 160,
1079 /// (ARRAY | PSEUDOTYPE(GEOMETRY))... -> PSEUDOTYPE(GEOMETRY)
1080 Polygon = 161,
1081 /// PSEUDOTYPE(GEOMETRY), PSEUDOTYPE(GEOMETRY) {geo_system:STRING, unit:STRING} -> NUMBER
1082 Distance = 162,
1083 /// PSEUDOTYPE(GEOMETRY), PSEUDOTYPE(GEOMETRY) -> BOOL
1084 Intersects = 163,
1085 /// PSEUDOTYPE(GEOMETRY), PSEUDOTYPE(GEOMETRY) -> BOOL
1086 Includes = 164,
1087 /// PSEUDOTYPE(GEOMETRY), NUMBER {num_vertices:NUMBER, geo_system:STRING, unit:STRING, fill:BOOL} -> PSEUDOTYPE(GEOMETRY)
1088 Circle = 165,
1089 /// TABLE, PSEUDOTYPE(GEOMETRY) {index:!STRING} -> StreamSelection
1090 GetIntersecting = 166,
1091 /// PSEUDOTYPE(GEOMETRY) -> PSEUDOTYPE(GEOMETRY)
1092 Fill = 167,
1093 /// TABLE, PSEUDOTYPE(GEOMETRY) {index:!STRING, max_results:NUM, max_dist:NUM, geo_system:STRING, unit:STRING} -> ARRAY
1094 GetNearest = 168,
1095 /// PSEUDOTYPE(GEOMETRY), PSEUDOTYPE(GEOMETRY) -> PSEUDOTYPE(GEOMETRY)
1096 PolygonSub = 171,
1097 /// Returns the datum as a JSON string.
1098 /// N.B.: we would really prefer this be named TO_JSON and that exists as
1099 /// an alias in Python and JavaScript drivers; however it conflicts with the
1100 /// standard `to_json` method defined by Ruby's standard json library.
1101 ///
1102 /// DATUM -> STRING
1103 ToJsonString = 172,
1104 /// Constants for specifying key ranges
1105 Minval = 180,
1106 Maxval = 181,
1107 /// Bitwise operations
1108 BitAnd = 191,
1109 BitOr = 192,
1110 BitXor = 193,
1111 BitNot = 194,
1112 BitSal = 195,
1113 BitSar = 196,
1114 }
1115}