2 * Copyright (c) 2017-present Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
21 #include "condition.hpp"
23 #include <type_traits>
28 template<typename Type>
33 template<typename O, typename F>
34 Expression<Column<O, F>> expr(F O::*field)
36 Column<O, F> anonymous = {"anonymous", field};
40 template<typename L, typename R>
41 struct Lesser : public condition::Binary<L, R> {
42 using condition::Binary<L, R>::Binary;
44 operator std::string() const
50 template<typename L, typename R>
51 Lesser<L, R> operator<(Expression<L> expr, R r)
53 return {expr.value, r};
56 template<typename L, typename R>
57 struct Equal : public condition::Binary<L, R>
59 using condition::Binary<L, R>::Binary;
61 operator std::string() const
67 template<typename L, typename R>
68 Equal<L, R> operator==(Expression<L> expr, R r)
70 return {expr.value, r};
75 template<typename L, typename R>
81 operator std::string() const
89 template<typename L, typename R>
90 join::Equal<L, R> operator==(Expression<L> l, Expression<R> r)
92 return {l.value, r.value};
95 template<typename L, typename R>
96 struct Greater : public condition::Binary<L, R>
98 using condition::Binary<L, R>::Binary;
100 operator std::string() const
106 template<typename L, typename R>
107 Greater<L, R> operator>(Expression<L> expr, R r)
109 return {expr.value, r};
112 template<bool B, typename T = void>
113 using enable_if_t = typename std::enable_if<B, T>::type;
116 using is_condition = typename std::is_base_of<condition::Base, T>;
120 typename = typename tsqb::enable_if_t<is_condition<L>::value
121 && tsqb::is_condition<R>::value>>
122 condition::And<L, R> operator&&(const L& l, const R& r)
129 typename = typename tsqb::enable_if_t<is_condition<L>::value
130 && tsqb::is_condition<R>::value>>
131 condition::Or<L, R> operator||(const L& l, const R& r)