unreql 0.2.1

Well documented and easy to use RethinkDB Rust Driver
Documentation
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
use unreql_macros::create_cmd;
use ql2::term::TermType;
use serde::Serialize;

use crate::{
    cmd::{args::ManyArgs, options::RandomOptions},
    Command,
};

create_cmd!(
    /// Sum two or more numbers, or concatenate two or more strings or arrays.
    ///
    /// The `add` command can be called in either prefix or infix form; both
    /// forms are equivalent. Note that ReQL will not perform type coercion.
    /// You cannot, for example, `add` a string and a number together.
    ///
    /// ## Example
    /// It’s as easy as 2 + 2 = 4.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(2).add(2).run(conn)
    /// // Result: 4
    /// # })
    /// ```
    ///
    /// ## Example
    /// Concatenate strings.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr("foo").add(r.args(["bar", "baz"])).run(conn)
    /// // Result: "foobarbaz"
    /// # })
    /// ```
    ///
    /// ## Example
    /// Concatenate arrays.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(["foo", "bar"]).add(["buzz"]).run(conn)
    /// // Result: [ "foo", "bar", "buzz" ]
    /// # })
    /// ```
    ///
    /// ## Example
    /// Create a date one year from now.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.now().add(365 * 24 * 60 * 60).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Use args with add to sum multiple values.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// let vals = vec![10, 20, 30];
    /// r.expr(0).add(r.args(&vals)).run(conn)
    /// // Result: 60
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [sub](Self::sub)
    /// - [mul](Self::mul)
    /// - [div](Self::div)
    /// - [mod_](Self::mod_)
    only_command,
    add(value: ManyArgs<()>)
);

create_cmd!(
    /// Subtract two numbers.
    ///
    /// ## Example
    /// It’s as easy as 2 - 2 = 0.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(2).sub(2).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Create a date one year ago today.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.now().sub(365*24*60*60).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Retrieve how many seconds elapsed between today and `date`.
    ///
    /// ```
    /// # use unreql::DateTime;
    /// # use time::OffsetDateTime;
    /// # unreql::example(|r, conn| {
    /// let date = DateTime::from(OffsetDateTime::now_utc());
    /// r.now().sub(date).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [add](Self::add)
    /// - [mul](Self::mul)
    /// - [div](Self::div)
    /// - [mod_](Self::mod_)
    only_command,
    sub(value: ManyArgs<()>)
);

create_cmd!(
    /// Multiply two numbers, or make a periodic array.
    ///
    /// ## Example
    /// It’s as easy as 2 * 2 = 4.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(2).mul(2).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Arrays can be multiplied by numbers as well.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(["This", "is", "the", "song", "that", "never", "ends."]).mul(100).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [add](Self::add)
    /// - [sub](Self::sub)
    /// - [div](Self::div)
    /// - [mod_](Self::mod_)
    only_command,
    mul(number: ManyArgs<()>)
);

create_cmd!(
    /// Divide two numbers.
    ///
    /// ## Example
    /// It’s as easy as 2 / 2 = 1.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(2).div(2).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [add](Self::add)
    /// - [sub](Self::sub)
    /// - [mul](Self::mul)
    /// - [mod_](Self::mod_)
    only_command,
    div(number: ManyArgs<()>)
);

create_cmd!(
    /// Find the remainder when dividing two numbers.
    ///
    /// ## Example
    /// It’s as easy as 2 % 2 = 0.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(2).mod_(2).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [add](Self::add)
    /// - [sub](Self::sub)
    /// - [mul](Self::mul)
    /// - [div](Self::div)
    only_command,
    mod_(number: ManyArgs<()>)
);

create_cmd!(
    /// Compute the logical “and” of one or more values.
    ///
    /// The `and` command can be used as an infix operator after its first
    /// argument (`r.expr(true).and(false)`) or given all of its arguments
    /// as parameters (`r.and(true,false)`).
    ///
    /// Calling `and` with zero arguments will return `true`.
    ///
    /// ## Example
    /// Return whether both `a` and `b` evaluate to true.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// let a = true;
    /// let b = false;
    /// r.expr(a).and(b).run(conn)
    /// // Result: false
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [or](Self::or)
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    and(boolean: ManyArgs<()>)
);

create_cmd!(
    /// Compute the logical “or” of one or more values.
    ///
    /// The `or` command can be used as an infix operator after its first
    /// argument (`r.expr(true).or(false)`) or given all of its arguments
    /// as parameters (`r.or(true,false)`).
    ///
    /// Calling `or` with zero arguments will return `false`.
    ///
    /// ## Example
    /// Return whether either `a` or `b` evaluate to true.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// let a = true;
    /// let b = false;
    /// r.expr(a).or(b).run(conn)
    /// // Result: true
    /// # })
    /// ```
    ///
    /// ## Example
    /// Return whether any of `a` or `b` evaluate to true.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// let a = false;
    /// let b = false;
    /// r.or(r.args([a, b])).run(conn)
    /// // Result: false
    /// # })
    /// ```
    ///
    /// *Note*: When using `or` inside a `filter` predicate to test the values
    /// of fields that may not exist on the documents being tested, you should
    /// use the `default` command with those fields so they explicitly return
    /// `false`.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("posts").filter(
    ///   r.row().g("category").default("foo").eq("article")
    ///     .or(r.row().g("category").default("foo").eq("mystery"))
    /// ).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [and](Self::and)
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    or(boolean: ManyArgs<()>)
);

create_cmd!(
    /// Test if two or more values are equal.
    ///
    /// ## Example
    /// See if a user’s role field is set to administrator.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("users").get(1).g("role").eq("administrator").run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// See if three variables contain equal values.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// # let (a, b, c) = (true, true, true);
    /// r.eq(r.args([a, b, c])).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [and](Self::and)
    /// - [or](Self::or)
    /// - [ne](Self::ne)
    eq(value: ManyArgs<()>)
);

create_cmd!(
    /// Test if two or more values are not equal.
    ///
    /// ## Example
    /// See if a user’s role field is not set to administrator.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("users").get(1).g("role").ne("administrator").run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// See if three variables do not contain equal values.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// # let (a, b, c) = (true, true, true);
    /// r.ne(r.args([a, b, c])).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [and](Self::and)
    /// - [or](Self::or)
    /// - [eq](Self::eq)
    ne(value: ManyArgs<()>)
);

create_cmd!(
    /// Compare values, testing if the left-hand value is greater than
    /// the right-hand.
    ///
    /// ## Example
    /// Test if a player has scored more than 10 points.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("players").get(1).g("score").gt(10).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Test if variables are ordered from lowest to highest, with no values being equal to one another.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// let (a, b, c) = (15, 20, 15);
    /// r.gt(r.args([a, b, c])).run(conn)
    /// # })
    /// ```
    ///
    /// This is the equivalent of the following:
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// # let (a, b, c) = (15, 20, 15);
    /// r.gt(r.args([a, b])).and(r.gt(r.args([b, c]))).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    /// - [ge](Self::ge)
    /// - [lt](Self::lt)
    /// - [le](Self::le)
    gt(value: ManyArgs<()>)
);

create_cmd!(
    /// Compare values, testing if the left-hand value is greater than or
    /// equal to the right-hand.
    ///
    /// ## Example
    /// Test if a player has scored 10 points or more.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("players").get(1).g("score").ge(10).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    /// - [gt](Self::gt)
    /// - [lt](Self::lt)
    /// - [le](Self::le)
    ge(value: ManyArgs<()>)
);

create_cmd!(
    /// Compare values, testing if the left-hand value is less than
    /// the right-hand.
    ///
    /// ## Example
    /// Test if a player has scored less than 10 points.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("players").get(1).g("score").lt(10).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    /// - [gt](Self::gt)
    /// - [ge](Self::ge)
    /// - [le](Self::le)
    lt(value: ManyArgs<()>)
);

create_cmd!(
    /// Compare values, testing if the left-hand value is less than or equal
    /// to the right-hand.
    ///
    /// ## Example
    /// Test if a player has scored 10 points or less.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("players").get(1).g("score").le(10).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    /// - [gt](Self::gt)
    /// - [ge](Self::ge)
    /// - [lt](Self::lt)
    le(value: ManyArgs<()>)
);

create_cmd!(
    /// Compute the logical inverse (not) of an expression.
    ///
    /// `not` can be called either via method chaining, immediately after
    /// an expression that evaluates as a boolean value, or by passing
    /// the expression as a parameter to `not`. All values that are not `false`
    /// or `null` will be converted to `true`.
    ///
    /// ## Example
    /// Not true is false.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.not(true).run(conn)
    /// // Result: false
    /// # })
    /// ```
    ///
    /// ## Example
    /// Return all the users that do not have a “flag” field.
    ///
    /// ```
    /// use unreql::func;
    /// # unreql::example(|r, conn| {
    /// r.table("users").filter(func!(|user| {
    ///   r.not(user.has_fields("flag"))
    /// })).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    only_root,
    not(boolean: Serialize)
);

create_cmd!(
    /// Compute the logical inverse (not) of an expression.
    ///
    /// `not` can be called either via method chaining, immediately after
    /// an expression that evaluates as a boolean value, or by passing
    /// the expression as a parameter to `not`. All values that are not `false`
    /// or `null` will be converted to `true`.
    ///
    /// ## Example
    /// Not true is false.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(true).not().run(conn)
    /// // Result: false
    /// # })
    /// ```
    ///
    /// ## Example
    /// Return all the users that do not have a “flag” field.
    ///
    /// ```
    /// use unreql::func;
    /// # unreql::example(|r, conn| {
    /// r.table("users").filter(func!(|user| {
    ///   user.has_fields("flag").not()
    /// })).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [eq](Self::eq)
    /// - [ne](Self::ne)
    only_command,
    not,
);

create_cmd!(
    /// Generate a random number between given (or implied) bounds.
    /// `random` takes zero, one or two arguments.
    ///
    /// - With *zero* arguments, the result will be a floating-point number
    ///   in the range `[0,1)` (from 0 up to but not including 1).
    /// - With *one* argument `x`, the result will be in the range `[0,x)`,
    ///   and will be integer unless `{float: true}` is given as an option.
    ///   Specifying a floating point number without the `float` option will
    ///   raise an error.
    /// - With *two* arguments `x` and `y`, the result will be in the range
    ///   `[x,y)`, and will be integer unless `{float: true}` is given as an
    ///   option. If `x` and `y` are equal an error will occur, unless the
    ///   floating-point option has been specified, in which case `x` will
    ///   be returned. Specifying a floating point number without the `float`
    ///   option will raise an error.
    ///
    /// *Note*: The last argument given will always be the ‘open’ side of the
    /// range, but when generating a floating-point number, the ‘open’ side
    /// may be less than the ‘closed’ side.
    ///
    /// ## Example
    /// Generate a random number in the range `[0,1)`
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.random(()).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Generate a random integer in the range `[0,100)`
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.random(100).run(conn)
    /// # });
    /// # unreql::example(|r, conn| {
    /// r.random(r.args([0, 100])).run(conn)
    /// # })
    /// ```
    ///
    /// ## Example
    /// Generate a random number in the range (-2.24,1.59]
    ///
    /// ```
    /// # use unreql::cmd::options::RandomOptions;
    /// # unreql::example(|r, conn| {
    /// let opts = RandomOptions::new().float(true);
    /// r.random(r.with_opt(r.args([1.59, -2.24]), opts)).run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [sample](Self::sample)
    random(numbers: ManyArgs<RandomOptions>)
);

create_cmd!(
    /// Rounds the given value to the nearest whole integer.
    ///
    /// For example, values of 1.0 up to but not including 1.5 will return 1.0,
    /// similar to `floor`; values of 1.5 up to 2.0 will return 2.0, similar
    /// to `ceil`.
    ///
    /// ## Example
    /// Round 12.345 to the nearest integer.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.round(12.345).run(conn)
    /// // Result: 12.0
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [ceil](Self::ceil)
    /// - [floor](Self::floor)
    only_root,
    round(number: Serialize)
);

create_cmd!(
    /// Rounds the given value to the nearest whole integer.
    ///
    /// For example, values of 1.0 up to but not including 1.5 will return 1.0,
    /// similar to `floor`; values of 1.5 up to 2.0 will return 2.0, similar
    /// to `ceil`.
    ///
    /// ## Example
    /// Round -12.345 to the nearest integer.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(-12.345).round().run(conn)
    /// // Result: -12.0
    /// # })
    /// ```
    ///
    /// ## Example
    /// Return Iron Man’s weight, rounded to the nearest integer.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("superheroes").get("ironman").g("weight").round().run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [ceil](Self::ceil)
    /// - [floor](Self::floor)
    only_command,
    round
);

create_cmd!(
    /// Rounds the given value up, returning the smallest integer value greater
    /// than or equal to the given value (the value’s ceiling).
    ///
    /// ## Example
    /// Return the ceiling of 12.345.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.ceil(12.345).run(conn)
    /// // Result: 13.0
    /// # })
    /// ```
    ///
    /// The `ceil` command can also be chained after an expression.
    ///
    /// # Related commands
    /// - [round](Self::round)
    /// - [floor](Self::floor)
    only_root,
    ceil(number: Serialize)
);

create_cmd!(
    /// Rounds the given value up, returning the smallest integer value greater
    /// than or equal to the given value (the value’s ceiling).
    ///
    /// ## Example
    /// Return the ceiling of -12.345.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(-12.345).round().run(conn)
    /// // Result: -12.0
    /// # })
    /// ```
    ///
    /// ## Example
    /// Return Iron Man’s weight, rounded up with ceil.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("superheroes").get("ironman").g("weight").ceil().run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [round](Self::round)
    /// - [floor](Self::floor)
    only_command,
    ceil
);

create_cmd!(
    /// Rounds the given value down, returning the largest integer value less
    /// than or equal to the given value (the value’s floor).
    ///
    /// ## Example
    /// Return the floor of 12.345.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.floor(12.345).run(conn)
    /// // Result: 12.0
    /// # })
    /// ```
    ///
    /// The floor command can also be chained after an expression.
    ///
    /// # Related commands
    /// - [round](Self::round)
    /// - [ceil](Self::ceil)
    only_root,
    floor(number: Serialize)
);

create_cmd!(
    /// Rounds the given value down, returning the largest integer value less
    /// than or equal to the given value (the value’s floor).
    ///
    /// ## Example
    /// Return the floor of -12.345.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(-12.345).floor().run(conn)
    /// // Result: -13.0
    /// # })
    /// ```
    ///
    /// ## Example
    /// Return Iron Man’s weight, rounded up with floor.
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.table("superheroes").get("ironman").g("weight").floor().run(conn)
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [round](Self::round)
    /// - [ceil](Self::ceil)
    only_command,
    floor
);

create_cmd!(
    /// A bitwise AND is a binary operation that takes two equal-length binary
    /// representations and performs the logical AND operation on each pair
    /// of the corresponding bits, which is equivalent to multiplying them.
    /// Thus, if both bits in the compared position are 1, the bit in the
    /// resulting binary representation is 1 (1 × 1 = 1); otherwise, the
    /// result is 0 (1 × 0 = 0 and 0 × 0 = 0).
    ///
    /// ## Example
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(5).bit_and(3).run(conn)
    /// // Result: 1
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [bit_not](Self::bit_not)
    /// - [bit_or](Self::bit_or)
    /// - [bit_xor](Self::bit_xor)
    /// - [bit_sal](Self::bit_sal)
    /// - [bit_sar](Self::bit_sar)
    bit_and(number: ManyArgs<()>)
);

create_cmd!(
    /// A bitwise OR is a binary operation that takes two bit patterns of equal
    /// length and performs the logical inclusive OR operation on each pair of
    /// corresponding bits. The result in each position is 0 if both bits are
    /// 0, while otherwise the result is 1.
    ///
    /// ## Example
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(5).bit_or(3).run(conn)
    /// // Result: 7
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [bit_not](Self::bit_not)
    /// - [bit_and](Self::bit_and)
    /// - [bit_xor](Self::bit_xor)
    /// - [bit_sal](Self::bit_sal)
    /// - [bit_sar](Self::bit_sar)
    bit_or(number: ManyArgs<()>)
);

create_cmd!(
    /// A bitwise XOR is a binary operation that takes two bit patterns of
    /// equal length and performs the logical exclusive OR operation on each
    /// pair of corresponding bits. The result in each position is 1 if only
    /// the first bit is 1 or only the second bit is 1, but will be 0 if both
    /// are 0 or both are 1. In this we perform the comparison of two bits,
    /// being 1 if the two bits are different, and 0 if they are the same.
    ///
    /// ## Example
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(6).bit_xor(4).run(conn)
    /// // Result: 2
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [bit_not](Self::bit_not)
    /// - [bit_and](Self::bit_and)
    /// - [bit_or](Self::bit_or)
    /// - [bit_sal](Self::bit_sal)
    /// - [bit_sar](Self::bit_sar)
    bit_xor(number: ManyArgs<()>)
);

create_cmd!(
    /// A bitwise NOT, or complement, is a unary operation that performs
    /// logical negation on each bit, forming the ones’ complement of the
    /// given binary value. Bits that are 0 become 1, and those that
    /// are 1 become 0.
    ///
    /// ## Example
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(7).bit_not().run(conn)
    /// // Result: -8
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [bit_and](Self::bit_and)
    /// - [bit_xor](Self::bit_xor)
    /// - [bit_or](Self::bit_or)
    /// - [bit_sal](Self::bit_sal)
    /// - [bit_sar](Self::bit_sar)
    bit_not
);

create_cmd!(
    /// In an arithmetic shift (also referred to as signed shift), like
    /// a logical shift, the bits that slide off the end disappear (except
    /// for the last, which goes into the carry flag). But in an arithmetic
    /// shift, the spaces are filled in such a way to preserve the sign of
    /// the number being slid. For this reason, arithmetic shifts are
    /// better suited for signed numbers in two’s complement format.
    ///
    /// *Note*: SHL and SAL are the same, and differentiation only happens
    /// because SAR and SHR (right shifting) has differences in their
    /// implementation.
    ///
    /// ## Example
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(5).bit_sal(4).run(conn)
    /// // Result: 80
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [bit_not](Self::bit_not)
    /// - [bit_and](Self::bit_and)
    /// - [bit_xor](Self::bit_xor)
    /// - [bit_or](Self::bit_or)
    /// - [bit_sar](Self::bit_sar)
    bit_sal(number: ManyArgs<()>)
);

create_cmd!(
    /// In an arithmetic shift (also referred to as signed shift), like
    /// a logical shift, the bits that slide off the end disappear (except
    /// for the last, which goes into the carry flag). But in an arithmetic
    /// shift, the spaces are filled in such a way to preserve the sign of
    /// the number being slid. For this reason, arithmetic shifts are better
    /// suited for signed numbers in two’s complement format.
    ///
    /// ## Example
    ///
    /// ```
    /// # unreql::example(|r, conn| {
    /// r.expr(32).bit_sal(3).run(conn)
    /// // Result: 4
    /// # })
    /// ```
    ///
    /// # Related commands
    /// - [bit_not](Self::bit_not)
    /// - [bit_and](Self::bit_and)
    /// - [bit_xor](Self::bit_xor)
    /// - [bit_or](Self::bit_or)
    /// - [bit_sal](Self::bit_sal)
    bit_sar(number: ManyArgs<()>)
);