/
UCS
/
sqlite_orm
Обзор
Документация
Войти
/
UCS
/
sqlite_orm
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
dev/ast/where.h
53 строки
2 KB
klaus triendl
Renamed file cxx_polyfill.h to cxx_type_traits_polyfill.h
28 май 2022, 11:32
28 май 2022, 11:32
1bed906
Код
Авторство
О чём код?
#pragma once #include <type_traits> // std::false_type, std::true_type #include <utility> // std::move #include "../functional/cxx_universal.h" #include "../functional/cxx_type_traits_polyfill.h" #include "../serialize_result_type.h" namespace sqlite_orm { namespace internal { struct where_string { serialize_result_type serialize() const { return "WHERE"; } }; /** * WHERE argument holder. * C is expression type. Can be any expression like: is_equal_t, is_null_t, exists_t etc * Don't construct it manually. Call `where(...)` function instead. */ template<class C> struct where_t : where_string { using expression_type = C; expression_type expression; where_t(expression_type expression_) : expression(std::move(expression_)) {} }; template<class T> SQLITE_ORM_INLINE_VAR constexpr bool is_where_v = polyfill::is_specialization_of_v<T, where_t>; template<class T> using is_where = polyfill::bool_constant<is_where_v<T>>; } /** * WHERE clause. Use it to add WHERE conditions wherever you like. * C is expression type. Can be any expression like: is_equal_t, is_null_t, exists_t etc * @example * // SELECT name * // FROM letters * // WHERE id > 3 * auto rows = storage.select(&Letter::name, where(greater_than(&Letter::id, 3))); */ template<class C> internal::where_t<C> where(C expression) { return {std::move(expression)}; } }