Skip to content

Commit

Permalink
simplified impl
Browse files Browse the repository at this point in the history
  • Loading branch information
fnc12 committed Oct 11, 2023
1 parent d840654 commit c2ede9f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
10 changes: 2 additions & 8 deletions dev/constraints.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,6 @@ namespace sqlite_orm {
template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_generated_always_v = is_generated_always<T>::value;

template<class T>
using is_null = std::is_same<null_t, T>;

template<class T>
using is_not_null = std::is_same<not_null_t, T>;

/**
* PRIMARY KEY INSERTABLE traits.
*/
Expand All @@ -467,8 +461,8 @@ namespace sqlite_orm {
using is_constraint =
mpl::instantiate<mpl::disjunction<check_if<is_primary_key>,
check_if<is_foreign_key>,
check_if<is_null>,
check_if<is_not_null>,
check_if_is_type<null_t>,
check_if_is_type<not_null_t>,
check_if_is_template<unique_t>,
check_if_is_template<default_t>,
check_if_is_template<check_t>,
Expand Down
3 changes: 1 addition & 2 deletions dev/statement_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1050,11 +1050,10 @@ namespace sqlite_orm {
ss << streaming_identifier(column.name);
if(!context.skip_types_and_constraints) {
ss << " " << type_printer<field_type_t<column_type>>().print();
const bool columnIsNotNull = column.is_not_null();
ss << " "
<< streaming_column_constraints(
call_as_template_base<column_constraints>(polyfill::identity{})(column),
columnIsNotNull,
column.is_not_null(),
context);
}
return ss.str();
Expand Down
13 changes: 3 additions & 10 deletions include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1729,12 +1729,6 @@ namespace sqlite_orm {
template<class T>
SQLITE_ORM_INLINE_VAR constexpr bool is_generated_always_v = is_generated_always<T>::value;

template<class T>
using is_null = std::is_same<null_t, T>;

template<class T>
using is_not_null = std::is_same<not_null_t, T>;

/**
* PRIMARY KEY INSERTABLE traits.
*/
Expand All @@ -1753,8 +1747,8 @@ namespace sqlite_orm {
using is_constraint =
mpl::instantiate<mpl::disjunction<check_if<is_primary_key>,
check_if<is_foreign_key>,
check_if<is_null>,
check_if<is_not_null>,
check_if_is_type<null_t>,
check_if_is_type<not_null_t>,
check_if_is_template<unique_t>,
check_if_is_template<default_t>,
check_if_is_template<check_t>,
Expand Down Expand Up @@ -16629,11 +16623,10 @@ namespace sqlite_orm {
ss << streaming_identifier(column.name);
if(!context.skip_types_and_constraints) {
ss << " " << type_printer<field_type_t<column_type>>().print();
const bool columnIsNotNull = column.is_not_null();
ss << " "
<< streaming_column_constraints(
call_as_template_base<column_constraints>(polyfill::identity{})(column),
columnIsNotNull,
column.is_not_null(),
context);
}
return ss.str();
Expand Down

0 comments on commit c2ede9f

Please sign in to comment.