This repository has been archived by the owner on Jan 3, 2024. It is now read-only.
forked from fnc12/sqlite_orm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcore_functions.h
2090 lines (1844 loc) · 73.1 KB
/
core_functions.h
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
#pragma once
#include <string> // std::string
#include <tuple> // std::make_tuple, std::tuple_size
#include <type_traits> // std::forward, std::is_base_of, std::enable_if
#include <memory> // std::unique_ptr
#include <vector> // std::vector
#include "functional/cxx_type_traits_polyfill.h"
#include "conditions.h"
#include "is_base_of_template.h"
#include "tuple_helper/tuple_filter.h"
#include "serialize_result_type.h"
#include "operators.h"
#include "ast/into.h"
namespace sqlite_orm {
using int64 = sqlite_int64;
using uint64 = sqlite_uint64;
namespace internal {
template<class T>
struct unique_ptr_result_of {};
/**
* Base class for operator overloading
* R - return type
* S - class with operator std::string
* Args - function arguments types
*/
template<class R, class S, class... Args>
struct built_in_function_t : S, arithmetic_t {
using return_type = R;
using string_type = S;
using args_type = std::tuple<Args...>;
static constexpr size_t args_size = std::tuple_size<args_type>::value;
args_type args;
built_in_function_t(args_type&& args_) : args(std::move(args_)) {}
};
template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_built_in_function_v = is_base_of_template_v<T, built_in_function_t>;
template<class T>
using is_built_in_function = polyfill::bool_constant<is_built_in_function_v<T>>;
template<class F, class W>
struct filtered_aggregate_function {
using function_type = F;
using where_expression = W;
function_type function;
where_expression where;
};
template<class C>
struct where_t;
template<class R, class S, class... Args>
struct built_in_aggregate_function_t : built_in_function_t<R, S, Args...> {
using super = built_in_function_t<R, S, Args...>;
using super::super;
template<class W>
filtered_aggregate_function<built_in_aggregate_function_t<R, S, Args...>, W> filter(where_t<W> wh) {
return {*this, std::move(wh.expression)};
}
};
struct typeof_string {
serialize_result_type serialize() const {
return "TYPEOF";
}
};
struct unicode_string {
serialize_result_type serialize() const {
return "UNICODE";
}
};
struct length_string {
serialize_result_type serialize() const {
return "LENGTH";
}
};
struct abs_string {
serialize_result_type serialize() const {
return "ABS";
}
};
struct lower_string {
serialize_result_type serialize() const {
return "LOWER";
}
};
struct upper_string {
serialize_result_type serialize() const {
return "UPPER";
}
};
struct last_insert_rowid_string {
serialize_result_type serialize() const {
return "LAST_INSERT_ROWID";
}
};
struct total_changes_string {
serialize_result_type serialize() const {
return "TOTAL_CHANGES";
}
};
struct changes_string {
serialize_result_type serialize() const {
return "CHANGES";
}
};
struct trim_string {
serialize_result_type serialize() const {
return "TRIM";
}
};
struct ltrim_string {
serialize_result_type serialize() const {
return "LTRIM";
}
};
struct rtrim_string {
serialize_result_type serialize() const {
return "RTRIM";
}
};
struct hex_string {
serialize_result_type serialize() const {
return "HEX";
}
};
struct quote_string {
serialize_result_type serialize() const {
return "QUOTE";
}
};
struct randomblob_string {
serialize_result_type serialize() const {
return "RANDOMBLOB";
}
};
struct instr_string {
serialize_result_type serialize() const {
return "INSTR";
}
};
struct replace_string {
serialize_result_type serialize() const {
return "REPLACE";
}
};
struct round_string {
serialize_result_type serialize() const {
return "ROUND";
}
};
#if SQLITE_VERSION_NUMBER >= 3007016
struct char_string {
serialize_result_type serialize() const {
return "CHAR";
}
};
struct random_string {
serialize_result_type serialize() const {
return "RANDOM";
}
};
#endif
struct coalesce_string {
serialize_result_type serialize() const {
return "COALESCE";
}
};
struct ifnull_string {
serialize_result_type serialize() const {
return "IFNULL";
}
};
struct nullif_string {
serialize_result_type serialize() const {
return "NULLIF";
}
};
struct date_string {
serialize_result_type serialize() const {
return "DATE";
}
};
struct time_string {
serialize_result_type serialize() const {
return "TIME";
}
};
struct datetime_string {
serialize_result_type serialize() const {
return "DATETIME";
}
};
struct julianday_string {
serialize_result_type serialize() const {
return "JULIANDAY";
}
};
struct strftime_string {
serialize_result_type serialize() const {
return "STRFTIME";
}
};
struct zeroblob_string {
serialize_result_type serialize() const {
return "ZEROBLOB";
}
};
struct substr_string {
serialize_result_type serialize() const {
return "SUBSTR";
}
};
#ifdef SQLITE_SOUNDEX
struct soundex_string {
serialize_result_type serialize() const {
return "SOUNDEX";
}
};
#endif
struct total_string {
serialize_result_type serialize() const {
return "TOTAL";
}
};
struct sum_string {
serialize_result_type serialize() const {
return "SUM";
}
};
struct count_string {
serialize_result_type serialize() const {
return "COUNT";
}
};
/**
* T is use to specify type explicitly for queries like
* SELECT COUNT(*) FROM table_name;
* T can be omitted with void.
*/
template<class T>
struct count_asterisk_t : count_string {
using type = T;
template<class W>
filtered_aggregate_function<count_asterisk_t<T>, W> filter(where_t<W> wh) {
return {*this, std::move(wh.expression)};
}
};
/**
* The same thing as count<T>() but without T arg.
* Is used in cases like this:
* SELECT cust_code, cust_name, cust_city, grade
* FROM customer
* WHERE grade=2 AND EXISTS
* (SELECT COUNT(*)
* FROM customer
* WHERE grade=2
* GROUP BY grade
* HAVING COUNT(*)>2);
* `c++`
* auto rows =
* storage.select(columns(&Customer::code, &Customer::name, &Customer::city, &Customer::grade),
* where(is_equal(&Customer::grade, 2)
* and exists(select(count<Customer>(),
* where(is_equal(&Customer::grade, 2)),
* group_by(&Customer::grade),
* having(greater_than(count(), 2))))));
*/
struct count_asterisk_without_type : count_string {};
struct avg_string {
serialize_result_type serialize() const {
return "AVG";
}
};
struct max_string {
serialize_result_type serialize() const {
return "MAX";
}
};
struct min_string {
serialize_result_type serialize() const {
return "MIN";
}
};
struct group_concat_string {
serialize_result_type serialize() const {
return "GROUP_CONCAT";
}
};
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
struct acos_string {
serialize_result_type serialize() const {
return "ACOS";
}
};
struct acosh_string {
serialize_result_type serialize() const {
return "ACOSH";
}
};
struct asin_string {
serialize_result_type serialize() const {
return "ASIN";
}
};
struct asinh_string {
serialize_result_type serialize() const {
return "ASINH";
}
};
struct atan_string {
serialize_result_type serialize() const {
return "ATAN";
}
};
struct atan2_string {
serialize_result_type serialize() const {
return "ATAN2";
}
};
struct atanh_string {
serialize_result_type serialize() const {
return "ATANH";
}
};
struct ceil_string {
serialize_result_type serialize() const {
return "CEIL";
}
};
struct ceiling_string {
serialize_result_type serialize() const {
return "CEILING";
}
};
struct cos_string {
serialize_result_type serialize() const {
return "COS";
}
};
struct cosh_string {
serialize_result_type serialize() const {
return "COSH";
}
};
struct degrees_string {
serialize_result_type serialize() const {
return "DEGREES";
}
};
struct exp_string {
serialize_result_type serialize() const {
return "EXP";
}
};
struct floor_string {
serialize_result_type serialize() const {
return "FLOOR";
}
};
struct ln_string {
serialize_result_type serialize() const {
return "LN";
}
};
struct log_string {
serialize_result_type serialize() const {
return "LOG";
}
};
struct log10_string {
serialize_result_type serialize() const {
return "LOG10";
}
};
struct log2_string {
serialize_result_type serialize() const {
return "LOG2";
}
};
struct mod_string {
serialize_result_type serialize() const {
return "MOD";
}
};
struct pi_string {
serialize_result_type serialize() const {
return "PI";
}
};
struct pow_string {
serialize_result_type serialize() const {
return "POW";
}
};
struct power_string {
serialize_result_type serialize() const {
return "POWER";
}
};
struct radians_string {
serialize_result_type serialize() const {
return "RADIANS";
}
};
struct sin_string {
serialize_result_type serialize() const {
return "SIN";
}
};
struct sinh_string {
serialize_result_type serialize() const {
return "SINH";
}
};
struct sqrt_string {
serialize_result_type serialize() const {
return "SQRT";
}
};
struct tan_string {
serialize_result_type serialize() const {
return "TAN";
}
};
struct tanh_string {
serialize_result_type serialize() const {
return "TANH";
}
};
struct trunc_string {
serialize_result_type serialize() const {
return "TRUNC";
}
};
#endif // SQLITE_ENABLE_MATH_FUNCTIONS
#ifdef SQLITE_ENABLE_JSON1
struct json_string {
serialize_result_type serialize() const {
return "JSON";
}
};
struct json_array_string {
serialize_result_type serialize() const {
return "JSON_ARRAY";
}
};
struct json_array_length_string {
serialize_result_type serialize() const {
return "JSON_ARRAY_LENGTH";
}
};
struct json_extract_string {
serialize_result_type serialize() const {
return "JSON_EXTRACT";
}
};
struct json_insert_string {
serialize_result_type serialize() const {
return "JSON_INSERT";
}
};
struct json_replace_string {
serialize_result_type serialize() const {
return "JSON_REPLACE";
}
};
struct json_set_string {
serialize_result_type serialize() const {
return "JSON_SET";
}
};
struct json_object_string {
serialize_result_type serialize() const {
return "JSON_OBJECT";
}
};
struct json_patch_string {
serialize_result_type serialize() const {
return "JSON_PATCH";
}
};
struct json_remove_string {
serialize_result_type serialize() const {
return "JSON_REMOVE";
}
};
struct json_type_string {
serialize_result_type serialize() const {
return "JSON_TYPE";
}
};
struct json_valid_string {
serialize_result_type serialize() const {
return "JSON_VALID";
}
};
struct json_quote_string {
serialize_result_type serialize() const {
return "JSON_QUOTE";
}
};
struct json_group_array_string {
serialize_result_type serialize() const {
return "JSON_GROUP_ARRAY";
}
};
struct json_group_object_string {
serialize_result_type serialize() const {
return "JSON_GROUP_OBJECT";
}
};
#endif // SQLITE_ENABLE_JSON1
template<class T>
using field_type_or_type_t = polyfill::detected_or_t<T, type_t, member_field_type<T>>;
}
/**
* Cute operators for core functions
*/
template<class F, class R, internal::satisfies<internal::is_built_in_function, F> = true>
internal::lesser_than_t<F, R> operator<(F f, R r) {
return {std::move(f), std::move(r)};
}
template<class F, class R, internal::satisfies<internal::is_built_in_function, F> = true>
internal::lesser_or_equal_t<F, R> operator<=(F f, R r) {
return {std::move(f), std::move(r)};
}
template<class F, class R, internal::satisfies<internal::is_built_in_function, F> = true>
internal::greater_than_t<F, R> operator>(F f, R r) {
return {std::move(f), std::move(r)};
}
template<class F, class R, internal::satisfies<internal::is_built_in_function, F> = true>
internal::greater_or_equal_t<F, R> operator>=(F f, R r) {
return {std::move(f), std::move(r)};
}
template<class F, class R, internal::satisfies<internal::is_built_in_function, F> = true>
internal::is_equal_t<F, R> operator==(F f, R r) {
return {std::move(f), std::move(r)};
}
template<class F, class R, internal::satisfies<internal::is_built_in_function, F> = true>
internal::is_not_equal_t<F, R> operator!=(F f, R r) {
return {std::move(f), std::move(r)};
}
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
/**
* ACOS(X) function https://www.sqlite.org/lang_mathfunc.html#acos
*
* Example:
*
* auto rows = storage.select(sqlite_orm::acos(&Triangle::cornerA)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::acos_string, X> acos(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ACOS(X) function https://www.sqlite.org/lang_mathfunc.html#acos
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::acos<std::optional<double>>(&Triangle::cornerA)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::acos_string, X> acos(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ACOSH(X) function https://www.sqlite.org/lang_mathfunc.html#acosh
*
* Example:
*
* auto rows = storage.select(sqlite_orm::acosh(&Triangle::cornerA)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::acosh_string, X> acosh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ACOSH(X) function https://www.sqlite.org/lang_mathfunc.html#acosh
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::acosh<std::optional<double>>(&Triangle::cornerA)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::acosh_string, X> acosh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ASIN(X) function https://www.sqlite.org/lang_mathfunc.html#asin
*
* Example:
*
* auto rows = storage.select(sqlite_orm::asin(&Triangle::cornerA)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::asin_string, X> asin(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ASIN(X) function https://www.sqlite.org/lang_mathfunc.html#asin
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::asin<std::optional<double>>(&Triangle::cornerA)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::asin_string, X> asin(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ASINH(X) function https://www.sqlite.org/lang_mathfunc.html#asinh
*
* Example:
*
* auto rows = storage.select(sqlite_orm::asinh(&Triangle::cornerA)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::asinh_string, X> asinh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ASINH(X) function https://www.sqlite.org/lang_mathfunc.html#asinh
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::asinh<std::optional<double>>(&Triangle::cornerA)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::asinh_string, X> asinh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ATAN(X) function https://www.sqlite.org/lang_mathfunc.html#atan
*
* Example:
*
* auto rows = storage.select(sqlite_orm::atan(1)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::atan_string, X> atan(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ATAN(X) function https://www.sqlite.org/lang_mathfunc.html#atan
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::atan<std::optional<double>>(1)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::atan_string, X> atan(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ATAN2(X, Y) function https://www.sqlite.org/lang_mathfunc.html#atan2
*
* Example:
*
* auto rows = storage.select(sqlite_orm::atan2(1, 3)); // decltype(rows) is std::vector<double>
*/
template<class X, class Y>
internal::built_in_function_t<double, internal::atan2_string, X, Y> atan2(X x, Y y) {
return {std::tuple<X, Y>{std::forward<X>(x), std::forward<Y>(y)}};
}
/**
* ATAN2(X, Y) function https://www.sqlite.org/lang_mathfunc.html#atan2
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::atan2<std::optional<double>>(1, 3)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X, class Y>
internal::built_in_function_t<R, internal::atan2_string, X, Y> atan2(X x, Y y) {
return {std::tuple<X, Y>{std::forward<X>(x), std::forward<Y>(y)}};
}
/**
* ATANH(X) function https://www.sqlite.org/lang_mathfunc.html#atanh
*
* Example:
*
* auto rows = storage.select(sqlite_orm::atanh(1)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::atanh_string, X> atanh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* ATANH(X) function https://www.sqlite.org/lang_mathfunc.html#atanh
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::atanh<std::optional<double>>(1)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::atanh_string, X> atanh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* CEIL(X) function https://www.sqlite.org/lang_mathfunc.html#ceil
*
* Example:
*
* auto rows = storage.select(sqlite_orm::ceil(&User::rating)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::ceil_string, X> ceil(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* CEIL(X) function https://www.sqlite.org/lang_mathfunc.html#ceil
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::ceil<std::optional<double>>(&User::rating)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::ceil_string, X> ceil(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* CEILING(X) function https://www.sqlite.org/lang_mathfunc.html#ceil
*
* Example:
*
* auto rows = storage.select(sqlite_orm::ceiling(&User::rating)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::ceiling_string, X> ceiling(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* CEILING(X) function https://www.sqlite.org/lang_mathfunc.html#ceil
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::ceiling<std::optional<double>>(&User::rating)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::ceiling_string, X> ceiling(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* COS(X) function https://www.sqlite.org/lang_mathfunc.html#cos
*
* Example:
*
* auto rows = storage.select(sqlite_orm::cos(&Triangle::cornerB)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::cos_string, X> cos(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* COS(X) function https://www.sqlite.org/lang_mathfunc.html#cos
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::cos<std::optional<double>>(&User::rating)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::cos_string, X> cos(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* COSH(X) function https://www.sqlite.org/lang_mathfunc.html#cosh
*
* Example:
*
* auto rows = storage.select(sqlite_orm::cosh(&Triangle::cornerB)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::cosh_string, X> cosh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* COSH(X) function https://www.sqlite.org/lang_mathfunc.html#cosh
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::cosh<std::optional<double>>(&User::rating)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::cosh_string, X> cosh(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* DEGREES(X) function https://www.sqlite.org/lang_mathfunc.html#degrees
*
* Example:
*
* auto rows = storage.select(sqlite_orm::degrees(&Triangle::cornerB)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::degrees_string, X> degrees(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* DEGREES(X) function https://www.sqlite.org/lang_mathfunc.html#degrees
*
* Difference with the previous function is that previous override has `double` as return type but this
* override accepts return type from you as a template argument. You can use any bindable type:
* `float`, `int`, `std::optional<double>` etc. This override is handy when you expect `null` as result.
*
* Example:
*
* auto rows = storage.select(sqlite_orm::degrees<std::optional<double>>(&User::rating)); // decltype(rows) is std::vector<std::optional<double>>
*/
template<class R, class X>
internal::built_in_function_t<R, internal::degrees_string, X> degrees(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* EXP(X) function https://www.sqlite.org/lang_mathfunc.html#exp
*
* Example:
*
* auto rows = storage.select(sqlite_orm::exp(&Triangle::cornerB)); // decltype(rows) is std::vector<double>
*/
template<class X>
internal::built_in_function_t<double, internal::exp_string, X> exp(X x) {
return {std::tuple<X>{std::forward<X>(x)}};
}
/**
* EXP(X) function https://www.sqlite.org/lang_mathfunc.html#exp
*