Lightweight 0.20250904.0
|
Represents a one-to-one relationship. More...
#include <BelongsTo.hpp>
Public Types | |
using | ReferencedRecord = MemberClassType< decltype(TheReferencedField)> |
Represents the record type of the other field. | |
using | BaseType = typename std::remove_cvref_t< decltype(std::declval< ReferencedRecord >().*ReferencedField)>::ValueType |
Represents the base column type of the foreign key, matching the primary key of the other record. | |
using | ValueType = std::conditional_t< Nullable==SqlNullable::Null, std::optional< BaseType >, BaseType > |
Public Member Functions | |
template<typename... S> requires std::constructible_from<ValueType, S...> | |
constexpr | BelongsTo (S &&... value) noexcept |
constexpr | BelongsTo (ReferencedRecord const &other) noexcept |
constexpr | BelongsTo (BelongsTo const &other) noexcept |
constexpr | BelongsTo (BelongsTo &&other) noexcept |
BelongsTo & | operator= (SqlNullType) noexcept |
BelongsTo & | operator= (ReferencedRecord &other) |
BelongsTo & | operator= (BelongsTo const &other) |
BelongsTo & | operator= (BelongsTo &&other) noexcept |
LIGHTWEIGHT_FORCE_INLINE constexpr void | SetModified (bool value) noexcept |
Marks the field as modified or unmodified. | |
LIGHTWEIGHT_FORCE_INLINE constexpr bool | IsModified () const noexcept |
Checks if the field is modified. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ValueType const & | Value () const noexcept |
Retrieves the reference to the value of the field. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ValueType & | MutableValue () noexcept |
Retrieves the mutable reference to the value of the field. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord & | Record () |
Retrieves a record from the relationship. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const & | Record () const |
Retrieves an immutable reference to the record from the relationship. | |
LIGHTWEIGHT_FORCE_INLINE constexpr bool | IsLoaded () const noexcept |
Checks if the record is loaded into memory. | |
LIGHTWEIGHT_FORCE_INLINE void | Unload () noexcept |
Unloads the record from memory. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord & | operator* () noexcept |
Retrieves the record from the relationship. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const & | operator* () const noexcept |
Retrieves the record from the relationship. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord * | operator-> () |
Retrieves the record from the relationship. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const * | operator-> () const |
Retrieves the record from the relationship. | |
LIGHTWEIGHT_FORCE_INLINE constexpr bool | operator! () const noexcept |
Checks if the field value is NULL. | |
LIGHTWEIGHT_FORCE_INLINE constexpr | operator bool () const noexcept |
Checks if the field value is not NULL. | |
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord & | EmplaceRecord () |
Emplaces a record into the relationship. This will mark the relationship as loaded. | |
LIGHTWEIGHT_FORCE_INLINE void | BindOutputColumn (SQLSMALLINT outputIndex, SqlStatement &stmt) |
std::weak_ordering | operator<=> (BelongsTo const &other) const noexcept |
template<detail::FieldElementType T, PrimaryKey IsPrimaryKeyValue = PrimaryKey::No> | |
std::weak_ordering | operator<=> (Field< T, IsPrimaryKeyValue > const &other) const noexcept |
bool | operator== (BelongsTo const &other) const noexcept |
bool | operator!= (BelongsTo const &other) const noexcept |
template<detail::FieldElementType T, PrimaryKey IsPrimaryKeyValue = PrimaryKey::No> | |
bool | operator== (Field< T, IsPrimaryKeyValue > const &other) const noexcept |
template<detail::FieldElementType T, PrimaryKey IsPrimaryKeyValue = PrimaryKey::No> | |
bool | operator!= (Field< T, IsPrimaryKeyValue > const &other) const noexcept |
void | SetAutoLoader (Loader loader) noexcept |
Used internally to configure on-demand loading of the record. | |
Static Public Attributes | |
static constexpr auto | ReferencedField = TheReferencedField |
The field in the other record that references the current record. | |
static constexpr std::string_view | ColumnNameOverride |
If not an empty string, this value will be used as the column name in the database. | |
static constexpr auto | IsOptional = Nullable == SqlNullable::Null |
static constexpr auto | IsMandatory = !IsOptional |
static constexpr auto | IsPrimaryKey = false |
static constexpr auto | IsAutoIncrementPrimaryKey = false |
Represents a one-to-one relationship.
The TheReferencedField
parameter is the field in the other record that references the current record, in the form of &OtherRecord::Field
. Other Field must be a primary key.
TheReferencedField | The field in the other record that references the current record. |
ColumnNameOverrideString | If not an empty string, this value will be used as the column name in the database. |
Definition at line 45 of file BelongsTo.hpp.
using Lightweight::BelongsTo< TheReferencedField, ColumnNameOverrideString, Nullable >::ReferencedRecord = MemberClassType<decltype(TheReferencedField)> |
Represents the record type of the other field.
Definition at line 70 of file BelongsTo.hpp.
using Lightweight::BelongsTo< TheReferencedField, ColumnNameOverrideString, Nullable >::BaseType = typename std::remove_cvref_t<decltype(std::declval<ReferencedRecord>().*ReferencedField)>::ValueType |
Represents the base column type of the foreign key, matching the primary key of the other record.
Definition at line 76 of file BelongsTo.hpp.
using Lightweight::BelongsTo< TheReferencedField, ColumnNameOverrideString, Nullable >::ValueType = std::conditional_t<Nullable == SqlNullable::Null, std::optional<BaseType>, BaseType> |
Represents the value type of the foreign key, which can be either an optional or a non-optional type of the referenced field,
Definition at line 81 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Definition at line 90 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Definition at line 95 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Definition at line 106 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Definition at line 115 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 124 of file BelongsTo.hpp.
|
inline |
Definition at line 135 of file BelongsTo.hpp.
|
inline |
Definition at line 154 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 168 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Marks the field as modified or unmodified.
Definition at line 186 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Checks if the field is modified.
Definition at line 189 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Retrieves the reference to the value of the field.
Definition at line 192 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Retrieves the mutable reference to the value of the field.
Definition at line 195 of file BelongsTo.hpp.
|
inlineconstexpr |
Retrieves a record from the relationship.
Definition at line 198 of file BelongsTo.hpp.
|
inlineconstexpr |
Retrieves an immutable reference to the record from the relationship.
Definition at line 201 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Checks if the record is loaded into memory.
Definition at line 204 of file BelongsTo.hpp.
|
inlinenoexcept |
Unloads the record from memory.
Definition at line 207 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Retrieves the record from the relationship.
Definition at line 210 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Retrieves the record from the relationship.
Definition at line 213 of file BelongsTo.hpp.
|
inlineconstexpr |
Retrieves the record from the relationship.
Definition at line 216 of file BelongsTo.hpp.
|
inlineconstexpr |
Retrieves the record from the relationship.
Definition at line 219 of file BelongsTo.hpp.
|
inlineconstexprnoexcept |
Checks if the field value is NULL.
Definition at line 222 of file BelongsTo.hpp.
|
inlineexplicitconstexprnoexcept |
Checks if the field value is not NULL.
Definition at line 225 of file BelongsTo.hpp.
|
inlineconstexpr |
Emplaces a record into the relationship. This will mark the relationship as loaded.
Definition at line 230 of file BelongsTo.hpp.
|
inline |
Definition at line 237 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 242 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 248 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 253 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 258 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 264 of file BelongsTo.hpp.
|
inlinenoexcept |
Definition at line 270 of file BelongsTo.hpp.
|
inlinenoexcept |
Used internally to configure on-demand loading of the record.
Definition at line 281 of file BelongsTo.hpp.
|
staticconstexpr |
The field in the other record that references the current record.
Definition at line 49 of file BelongsTo.hpp.
|
staticconstexpr |
If not an empty string, this value will be used as the column name in the database.
Definition at line 52 of file BelongsTo.hpp.
|
staticconstexpr |
Definition at line 83 of file BelongsTo.hpp.
|
staticconstexpr |
Definition at line 84 of file BelongsTo.hpp.
|
staticconstexpr |
Definition at line 85 of file BelongsTo.hpp.
|
staticconstexpr |
Definition at line 86 of file BelongsTo.hpp.