4#include <Lightweight/Lightweight.hpp>
15 std::weak_ordering operator<=>(Person
const& other)
const =
default;
24 static constexpr std::string_view TableName = Light::RecordTableName<Person>;
27inline std::ostream& operator<<(std::ostream& os, Person
const& value)
29 return os << std::format(
"Person {{ id: {}, name: {}, is_active: {}, age: {} }}",
32 value.is_active.Value(),
33 value.age.Value().value_or(-1));
53 constexpr std::weak_ordering operator<=>(Email
const& other)
const =
default;
67 constexpr std::weak_ordering operator<=>(Physician
const& other)
const
69 if (
auto result =
id.Value() <=> other.id.Value(); result != std::weak_ordering::equivalent)
72 if (
auto result = name.
Value() <=> other.name.Value(); result != std::weak_ordering::equivalent)
75 return std::weak_ordering::equivalent;
87 constexpr std::weak_ordering operator<=>(Patient
const& other)
const
89 if (
auto result =
id.Value() <=> other.id.Value(); result != std::weak_ordering::equivalent)
92 if (
auto result = name.
Value() <=> other.name.Value(); result != std::weak_ordering::equivalent)
95 if (
auto result = comment.
Value() <=> other.comment.Value(); result != std::weak_ordering::equivalent)
98 return std::weak_ordering::equivalent;
110 constexpr std::weak_ordering operator<=>(Appointment
const& other)
const
112 if (
auto const result =
id.Value() <=> other.id.Value(); result != std::weak_ordering::equivalent)
115 if (
auto const result = date.
Value() <=> other.date.Value(); result != std::weak_ordering::equivalent)
118 if (
auto const result = comment.
Value() <=> other.comment.Value(); result != std::weak_ordering::equivalent)
121 if (
auto const result = physician.Value() <=> other.physician.Value(); result != std::weak_ordering::equivalent)
124 if (
auto const result = patient.Value() <=> other.patient.Value(); result != std::weak_ordering::equivalent)
127 return std::weak_ordering::equivalent;
Represents a one-to-one relationship.
This API represents a many-to-many relationship between two records through a third record.
This HasMany<OtherRecord> represents a simple one-to-many relationship between two records.
Represents a single column in a table.
constexpr T const & Value() const noexcept
Returns the value of the field.
Helper class, used to represent a real SQL column names as template arguments.