Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
lookup_table_name() can return a reference to the table name
Browse files Browse the repository at this point in the history
  • Loading branch information
trueqbit committed Feb 7, 2023
1 parent 35db7c8 commit f7f55c1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dev/storage_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ namespace sqlite_orm {
}

template<class Lookup, class DBOs, satisfies<is_db_objects, DBOs>>
std::string lookup_table_name(const DBOs& dbObjects) {
decltype(auto) lookup_table_name(const DBOs& dbObjects) {
return static_if<is_mapped_v<DBOs, Lookup>>(
[](const auto& dbObjects) {
[](const auto& dbObjects) -> const std::string& {
return pick_table<Lookup>(dbObjects).name;
},
empty_callable<std::string>())(dbObjects);
Expand Down
2 changes: 1 addition & 1 deletion dev/storage_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace sqlite_orm {
auto lookup_table(const DBOs& dbObjects);

template<class Lookup, class DBOs, satisfies<is_db_objects, DBOs> = true>
std::string lookup_table_name(const DBOs& dbObjects);
decltype(auto) lookup_table_name(const DBOs& dbObjects);

}
}
6 changes: 3 additions & 3 deletions include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -9394,7 +9394,7 @@ namespace sqlite_orm {
auto lookup_table(const DBOs& dbObjects);

template<class Lookup, class DBOs, satisfies<is_db_objects, DBOs> = true>
std::string lookup_table_name(const DBOs& dbObjects);
decltype(auto) lookup_table_name(const DBOs& dbObjects);

}
}
Expand Down Expand Up @@ -10514,9 +10514,9 @@ namespace sqlite_orm {
}

template<class Lookup, class DBOs, satisfies<is_db_objects, DBOs>>
std::string lookup_table_name(const DBOs& dbObjects) {
decltype(auto) lookup_table_name(const DBOs& dbObjects) {
return static_if<is_mapped_v<DBOs, Lookup>>(
[](const auto& dbObjects) {
[](const auto& dbObjects) -> const std::string& {
return pick_table<Lookup>(dbObjects).name;
},
empty_callable<std::string>())(dbObjects);
Expand Down

0 comments on commit f7f55c1

Please sign in to comment.