Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to podrm #13

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ IncludeBlocks: Regroup
IncludeCategories:
- Regex: "^\""
Priority: 0
- Regex: "^<pfr-orm/"
- Regex: "^<podrm/"
CaseSensitive: true
Priority: 1
- Regex: "^<(fmt/|boost/|libpq-fe\\.h|sqlite3\\.h>)"
Expand Down
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@ cmake_minimum_required(VERSION 3.7)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(pfr-orm LANGUAGES C CXX)
project(podrm LANGUAGES C CXX)

add_subdirectory(vendor)

find_package(fmt REQUIRED)
find_package(PostgreSQL REQUIRED)
find_package(SQLite3 REQUIRED)

add_library(pfr-orm STATIC)
target_compile_features(pfr-orm PUBLIC cxx_std_20)
add_library(podrm STATIC)
target_compile_features(podrm PUBLIC cxx_std_20)
target_sources(
pfr-orm PRIVATE lib/sqlite/utils.cpp lib/sqlite/operations.cpp
podrm PRIVATE lib/sqlite/utils.cpp lib/sqlite/operations.cpp
lib/postgres/utils.cpp lib/postgres/operations.cpp)
target_include_directories(pfr-orm PUBLIC include)
target_include_directories(podrm PUBLIC include)
target_link_libraries(
pfr-orm
podrm
PUBLIC Boost::pfr
PRIVATE PostgreSQL::PostgreSQL SQLite::SQLite3 fmt::fmt)

option(PFR_ORM_USE_GSL_SPAN
"Use Microsoft.GSL for span implementation instead of std::span" OFF)
if(PFR_ORM_USE_GSL_SPAN)
target_compile_definitions(pfr-orm PUBLIC PFR_ORM_USE_GSL_SPAN)
target_compile_definitions(podrm PUBLIC PFR_ORM_USE_GSL_SPAN)
find_package(Microsoft.GSL REQUIRED)
target_link_libraries(pfr-orm PUBLIC Microsoft.GSL::GSL)
target_link_libraries(podrm PUBLIC Microsoft.GSL::GSL)
endif()

option(PFR_ORM_ASAN "Build pfr-orm with address sanitizer" OFF)
option(PFR_ORM_ASAN "Build podrm with address sanitizer" OFF)

if(PFR_ORM_ASAN)
target_compile_options(pfr-orm PRIVATE -fsanitize=address)
target_link_options(pfr-orm PRIVATE -fsanitize=address)
target_compile_options(podrm PRIVATE -fsanitize=address)
target_link_options(podrm PRIVATE -fsanitize=address)
endif()

option(PFR_ORM_TEST "Generate test target for pfr-orm" OFF)
option(PFR_ORM_TEST "Generate test target for podrm" OFF)

if(PFR_ORM_TEST)
add_subdirectory(test)
Expand Down
8 changes: 4 additions & 4 deletions include/pfr-orm/api.hpp → include/podrm/api.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <pfr-orm/detail/field.hpp>
#include <pfr-orm/detail/pfr.hpp>
#include <podrm/detail/field.hpp>
#include <podrm/detail/pfr.hpp>

#include <cstddef>
#include <cstdint>
Expand All @@ -16,7 +16,7 @@ static_assert(BOOST_PFR_ENABLED, "Boost.PFR is not supported, cannot build");
static_assert(BOOST_PFR_CORE_NAME_ENABLED,
"Boost.PFR does not support field name extraction, cannot build");

namespace pfrorm {
namespace podrm {

/// Identifier mode
enum class IdMode : std::uint8_t {
Expand Down Expand Up @@ -99,4 +99,4 @@ inline constexpr auto ValueRegistration<std::string> =
/// Tag to be used with boost::pfr::is_reflectable*
struct ReflectionTag;

} // namespace pfrorm
} // namespace podrm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <pfr-orm/api.hpp>
#include <pfr-orm/detail/pfr.hpp>
#include <pfr-orm/detail/span.hpp>
#include <pfr-orm/detail/type_name.hpp>
#include <podrm/api.hpp>
#include <podrm/detail/pfr.hpp>
#include <podrm/detail/span.hpp>
#include <podrm/detail/type_name.hpp>

#include <array>
#include <cstddef>
Expand All @@ -17,7 +17,7 @@
#include <boost/pfr/core_name.hpp>
#include <boost/pfr/tuple_size.hpp>

namespace pfrorm {
namespace podrm {

struct PrimitiveFieldDescription {
NativeType nativeType;
Expand Down Expand Up @@ -157,4 +157,4 @@ constexpr EntityDescription DatabaseEntityDescription{
.primaryKey = EntityRegistration<T>.id.get(),
};

} // namespace pfrorm
} // namespace podrm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <pfr-orm/detail/member_name.hpp>
#include <pfr-orm/detail/pfr.hpp>
#include <podrm/detail/member_name.hpp>
#include <podrm/detail/pfr.hpp>

#include <algorithm>
#include <array>
Expand All @@ -13,7 +13,7 @@

#include <boost/pfr/core_name.hpp>

namespace pfrorm::detail {
namespace podrm::detail {

template <Reflectable T, const auto MemberPtr>
constexpr std::size_t getFieldIndex() {
Expand Down Expand Up @@ -43,4 +43,4 @@ template <auto MemberPtr>
requires(std::is_member_pointer_v<decltype(MemberPtr)>)
using MemberPtrClass = typename MemberPtrClassImpl<MemberPtr>::Type;

} // namespace pfrorm::detail
} // namespace podrm::detail
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstddef>
#include <string_view>

namespace pfrorm::detail {
namespace podrm::detail {

template <const auto MemberPtr>
constexpr std::string_view wrappedMemberNameImpl() {
Expand Down Expand Up @@ -57,4 +57,4 @@ template <const auto MemberPtr>
constexpr std::string_view SimpleMemberName =
simplifyMemberName(MemberName<MemberPtr>);

} // namespace pfrorm::detail
} // namespace podrm::detail
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <boost/pfr/traits.hpp>

namespace pfrorm::detail {
namespace podrm::detail {

template <typename T>
concept Reflectable = boost::pfr::is_implicitly_reflectable_v<T, void>;

} // namespace pfrorm::detail
} // namespace podrm::detail
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
#include <span>
#endif

namespace pfrorm::detail {
namespace podrm::detail {

#ifdef PFR_ORM_USE_GSL_SPAN
template <typename T> using span = gsl::span<T>;
#else
template <typename T> using span = std::span<T>;
#endif

} // namespace pfrorm::detail
} // namespace podrm::detail
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstddef>
#include <string_view>

namespace pfrorm::detail {
namespace podrm::detail {

template <typename T> constexpr std::string_view wrappedTypeNameImpl() {
#ifdef __clang__
Expand Down Expand Up @@ -50,4 +50,4 @@ constexpr std::string_view simplifyTypeName(std::string_view name) {
template <typename T>
constexpr std::string_view SimpleTypeName = simplifyTypeName(TypeName<T>);

} // namespace pfrorm::detail
} // namespace podrm::detail
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include <pfr-orm/definitions.hpp>
#include <pfr-orm/sqlite/utils.hpp>
#include <podrm/definitions.hpp>
#include <podrm/postgres/utils.hpp>

namespace pfrorm::sqlite::detail {
namespace podrm::postgres::detail {

void createTable(Connection &connection, const EntityDescription &entity);

bool exists(Connection &connection, const EntityDescription &entity);

} // namespace pfrorm::sqlite::detail
} // namespace podrm::postgres::detail
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <pfr-orm/definitions.hpp>
#include <pfr-orm/sqlite/detail/operations.hpp>
#include <pfr-orm/sqlite/utils.hpp>
#include <podrm/definitions.hpp>
#include <podrm/postgres/detail/operations.hpp>
#include <podrm/postgres/utils.hpp>

namespace pfrorm::sqlite {
namespace podrm::postgres {

template <DatabaseEntity T> void createTable(Connection &connection) {
return detail::createTable(connection, DatabaseEntityDescription<T>);
Expand All @@ -14,4 +14,4 @@ template <typename T> bool exists(Connection &connection) {
return detail::exists(connection, DatabaseEntityDescription<T>);
}

} // namespace pfrorm::sqlite
} // namespace podrm::postgres
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
struct pg_conn;
struct pg_result;

namespace pfrorm::postgres {
namespace podrm::postgres {

class Str {
public:
Expand Down Expand Up @@ -93,4 +93,4 @@ ParameterTraits::toParam(const std::string &value) {
template <typename T>
concept AsParameter = requires { ParameterTraits::toParam<T>; };

} // namespace pfrorm::postgres
} // namespace podrm::postgres
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#pragma once

#include <pfr-orm/definitions.hpp>
#include <pfr-orm/postgres/utils.hpp>
#include <podrm/definitions.hpp>
#include <podrm/sqlite/utils.hpp>

namespace pfrorm::postgres::detail {
namespace podrm::sqlite::detail {

void createTable(Connection &connection, const EntityDescription &entity);

bool exists(Connection &connection, const EntityDescription &entity);

} // namespace pfrorm::postgres::detail
} // namespace podrm::sqlite::detail
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#pragma once

#include <pfr-orm/definitions.hpp>
#include <pfr-orm/postgres/detail/operations.hpp>
#include <pfr-orm/postgres/utils.hpp>
#include <podrm/definitions.hpp>
#include <podrm/sqlite/detail/operations.hpp>
#include <podrm/sqlite/utils.hpp>

namespace pfrorm::postgres {
namespace podrm::sqlite {

template <DatabaseEntity T> void createTable(Connection &connection) {
return detail::createTable(connection, DatabaseEntityDescription<T>);
Expand All @@ -14,4 +14,4 @@ template <typename T> bool exists(Connection &connection) {
return detail::exists(connection, DatabaseEntityDescription<T>);
}

} // namespace pfrorm::postgres
} // namespace podrm::sqlite
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
struct sqlite3;
struct sqlite3_stmt;

namespace pfrorm::sqlite {
namespace podrm::sqlite {

class Row {
public:
Expand Down Expand Up @@ -84,4 +84,4 @@ class Connection {
explicit Connection(sqlite3 *connection);
};

} // namespace pfrorm::sqlite
} // namespace podrm::sqlite
4 changes: 2 additions & 2 deletions lib/detail/multilambda.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

namespace pfrorm::detail {
namespace podrm::detail {

/// Invocable that overloads its call operator using call operators of the
/// parent classes
Expand All @@ -11,4 +11,4 @@ template <typename... Ts> struct MultiLambda : Ts... {

template <typename... Ts> MultiLambda(Ts...) -> MultiLambda<Ts...>;

} // namespace pfrorm::detail
} // namespace podrm::detail
6 changes: 3 additions & 3 deletions lib/postgres/formatters.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#pragma once

#include <pfr-orm/postgres/utils.hpp>
#include <podrm/postgres/utils.hpp>

#include <string_view>

#include <fmt/core.h>
#include <fmt/format.h>

template <>
struct fmt::formatter<pfrorm::postgres::Str> : formatter<std::string_view> {
struct fmt::formatter<podrm::postgres::Str> : formatter<std::string_view> {
public:
template <typename FormatContext>
constexpr auto format(const pfrorm::postgres::Str &str,
constexpr auto format(const podrm::postgres::Str &str,
FormatContext &ctx) const -> decltype(ctx.out()) {
return formatter<std::string_view>::format(str.view(), ctx);
}
Expand Down
12 changes: 6 additions & 6 deletions lib/postgres/operations.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "../detail/multilambda.hpp"
#include "formatters.hpp" // IWYU pragma: keep

#include <pfr-orm/api.hpp>
#include <pfr-orm/definitions.hpp>
#include <pfr-orm/postgres/utils.hpp>
#include <podrm/api.hpp>
#include <podrm/definitions.hpp>
#include <podrm/postgres/utils.hpp>

#include <cstddef>
#include <stdexcept>
Expand All @@ -16,7 +16,7 @@
#include <fmt/core.h>
#include <fmt/format.h>

namespace pfrorm::postgres::detail {
namespace podrm::postgres::detail {

namespace {

Expand Down Expand Up @@ -58,7 +58,7 @@ void createTableFields(const FieldDescription &description,
}
};

const pfrorm::detail::MultiLambda createField{
const podrm::detail::MultiLambda createField{
createPrimitiveField,
createCompositeField,
};
Expand Down Expand Up @@ -96,4 +96,4 @@ bool exists(Connection &connection, const EntityDescription &entity) {
return result.value(0, 0)[0] == 't';
}

} // namespace pfrorm::postgres::detail
} // namespace podrm::postgres::detail
6 changes: 3 additions & 3 deletions lib/postgres/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <pfr-orm/postgres/utils.hpp>
#include <podrm/postgres/utils.hpp>

#include <stdexcept>
#include <string>
Expand All @@ -7,7 +7,7 @@
#include <fmt/core.h>
#include <libpq-fe.h>

namespace pfrorm::postgres {
namespace podrm::postgres {

Str::~Str() { PQfreemem(this->str); }

Expand Down Expand Up @@ -66,4 +66,4 @@ Result Connection::query(const std::string &statement) {
return result;
}

} // namespace pfrorm::postgres
} // namespace podrm::postgres
Loading
Loading