Lightweight 0.20250904.0
Loading...
Searching...
No Matches
Lightweight::HasOneThrough< OtherTable, ThroughTable > Class Template Reference

Represents a one-to-one relationship through a join table. More...

#include <HasOneThrough.hpp>

Public Types

using ThroughRecord = ThroughTable
 The record type of the "through" side of the relationship.
 
using ReferencedRecord = OtherTable
 The record type of the "Other" side of the relationship.
 

Public Member Functions

LIGHTWEIGHT_FORCE_INLINE constexpr void EmplaceRecord (std::shared_ptr< ReferencedRecord > record)
 Emplaces the given record into this relationship.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecordRecord () noexcept
 Retrieves the record in this relationship.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const & Record () const noexcept
 Retrieves the record in this relationship.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool IsLoaded () const noexcept
 Checks if the record is loaded.
 
LIGHTWEIGHT_FORCE_INLINE void Unload () noexcept
 Unloads the record from memory.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecordoperator* () noexcept
 Retrieves the record in this relationship.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const & operator* () const noexcept
 Retrieves the record in this relationship.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecordoperator-> () noexcept
 Retrieves the record in this relationship.
 
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const * operator-> () const noexcept
 Retrieves the record in this relationship.
 
std::weak_ordering operator<=> (HasOneThrough const &other) const noexcept=default
 
void SetAutoLoader (Loader loader)
 Used internally to configure on-demand loading of the record.
 

Detailed Description

template<typename OtherTable, typename ThroughTable>
class Lightweight::HasOneThrough< OtherTable, ThroughTable >

Represents a one-to-one relationship through a join table.

The OtherField parameter is the field in the join table that references the other record. The ThroughField parameter is the field in the join table that references the current record.

Definition at line 23 of file HasOneThrough.hpp.

Member Typedef Documentation

◆ ThroughRecord

template<typename OtherTable , typename ThroughTable >
using Lightweight::HasOneThrough< OtherTable, ThroughTable >::ThroughRecord = ThroughTable

The record type of the "through" side of the relationship.

Definition at line 27 of file HasOneThrough.hpp.

◆ ReferencedRecord

template<typename OtherTable , typename ThroughTable >
using Lightweight::HasOneThrough< OtherTable, ThroughTable >::ReferencedRecord = OtherTable

The record type of the "Other" side of the relationship.

Definition at line 30 of file HasOneThrough.hpp.

Member Function Documentation

◆ EmplaceRecord()

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr void Lightweight::HasOneThrough< OtherTable, ThroughTable >::EmplaceRecord ( std::shared_ptr< ReferencedRecord record)
inlineconstexpr

Emplaces the given record into this relationship.

Definition at line 35 of file HasOneThrough.hpp.

◆ Record() [1/2]

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord & Lightweight::HasOneThrough< OtherTable, ThroughTable >::Record ( )
inlineconstexprnoexcept

Retrieves the record in this relationship.

Definition at line 38 of file HasOneThrough.hpp.

◆ Record() [2/2]

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const & Lightweight::HasOneThrough< OtherTable, ThroughTable >::Record ( ) const
inlineconstexprnoexcept

Retrieves the record in this relationship.

Definition at line 41 of file HasOneThrough.hpp.

◆ IsLoaded()

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::HasOneThrough< OtherTable, ThroughTable >::IsLoaded ( ) const
inlineconstexprnoexcept

Checks if the record is loaded.

Definition at line 44 of file HasOneThrough.hpp.

◆ Unload()

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE void Lightweight::HasOneThrough< OtherTable, ThroughTable >::Unload ( )
inlinenoexcept

Unloads the record from memory.

Definition at line 47 of file HasOneThrough.hpp.

◆ operator*() [1/2]

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord & Lightweight::HasOneThrough< OtherTable, ThroughTable >::operator* ( )
inlineconstexprnoexcept

Retrieves the record in this relationship.

Note
On-demand loads the record if it is not already loaded.

Definition at line 51 of file HasOneThrough.hpp.

◆ operator*() [2/2]

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const & Lightweight::HasOneThrough< OtherTable, ThroughTable >::operator* ( ) const
inlineconstexprnoexcept

Retrieves the record in this relationship.

Note
On-demand loads the record if it is not already loaded.

Definition at line 55 of file HasOneThrough.hpp.

◆ operator->() [1/2]

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord * Lightweight::HasOneThrough< OtherTable, ThroughTable >::operator-> ( )
inlineconstexprnoexcept

Retrieves the record in this relationship.

Note
On-demand loads the record if it is not already loaded.

Definition at line 59 of file HasOneThrough.hpp.

◆ operator->() [2/2]

template<typename OtherTable , typename ThroughTable >
LIGHTWEIGHT_FORCE_INLINE constexpr ReferencedRecord const * Lightweight::HasOneThrough< OtherTable, ThroughTable >::operator-> ( ) const
inlineconstexprnoexcept

Retrieves the record in this relationship.

Note
On-demand loads the record if it is not already loaded.

Definition at line 63 of file HasOneThrough.hpp.

◆ SetAutoLoader()

template<typename OtherTable , typename ThroughTable >
void Lightweight::HasOneThrough< OtherTable, ThroughTable >::SetAutoLoader ( Loader  loader)
inline

Used internally to configure on-demand loading of the record.

Definition at line 74 of file HasOneThrough.hpp.

Referenced by Lightweight::DataMapper::ConfigureRelationAutoLoading().


The documentation for this class was generated from the following file: