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