Lightweight 0.20260303.0
Loading...
Searching...
No Matches
Lightweight::SqlDate Struct Reference

#include <SqlDate.hpp>

Public Member Functions

constexpr SqlDate () noexcept=default
 Default constructor.
 
constexpr SqlDate (SqlDate &&) noexcept=default
 Default move constructor.
 
constexpr SqlDateoperator= (SqlDate &&) noexcept=default
 Default move assignment operator.
 
constexpr SqlDate (SqlDate const &) noexcept=default
 Default copy constructor.
 
constexpr SqlDateoperator= (SqlDate const &) noexcept=default
 Default copy assignment operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr std::chrono::year_month_day value () const noexcept
 Returns the current date.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator== (SqlDate const &other) const noexcept
 Equality comparison operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator!= (SqlDate const &other) const noexcept
 Inequality comparison operator.
 
constexpr SqlDate (std::chrono::year_month_day value) noexcept
 Constructs a date from individual std::chrono::year_month_day.
 
constexpr SqlDate (std::chrono::year year, std::chrono::month month, std::chrono::day day) noexcept
 Constructs a date from individual components.
 

Static Public Member Functions

static LIGHTWEIGHT_FORCE_INLINE SqlDate Today () noexcept
 Returns the current date.
 
static LIGHTWEIGHT_FORCE_INLINE constexpr SQL_DATE_STRUCT ConvertToSqlValue (std::chrono::year_month_day value) noexcept
 Converts a std::chrono::year_month_day to the underlying SQL date structure.
 
static LIGHTWEIGHT_FORCE_INLINE constexpr std::chrono::year_month_day ConvertToNative (SQL_DATE_STRUCT const &value) noexcept
 Converts a SQL date structure to std::chrono::year_month_day.
 

Public Attributes

SQL_DATE_STRUCT sqlValue {}
 Holds the underlying SQL date structure.
 

Detailed Description

Represents a date to efficiently write to or read from a database.

Definition at line 17 of file SqlDate.hpp.

Constructor & Destructor Documentation

◆ SqlDate() [1/2]

constexpr Lightweight::SqlDate::SqlDate ( std::chrono::year_month_day  value)
inlineconstexprnoexcept

Constructs a date from individual std::chrono::year_month_day.

Definition at line 54 of file SqlDate.hpp.

References ConvertToSqlValue(), and value().

◆ SqlDate() [2/2]

constexpr Lightweight::SqlDate::SqlDate ( std::chrono::year  year,
std::chrono::month  month,
std::chrono::day  day 
)
inlineconstexprnoexcept

Constructs a date from individual components.

Definition at line 60 of file SqlDate.hpp.

Member Function Documentation

◆ value()

LIGHTWEIGHT_FORCE_INLINE constexpr std::chrono::year_month_day Lightweight::SqlDate::value ( ) const
inlineconstexprnoexcept

Returns the current date.

Definition at line 35 of file SqlDate.hpp.

References ConvertToNative(), and sqlValue.

Referenced by ConvertToNative(), ConvertToSqlValue(), and SqlDate().

◆ operator==()

LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDate::operator== ( SqlDate const &  other) const
inlineconstexprnoexcept

Equality comparison operator.

Definition at line 41 of file SqlDate.hpp.

References sqlValue.

◆ operator!=()

LIGHTWEIGHT_FORCE_INLINE constexpr bool Lightweight::SqlDate::operator!= ( SqlDate const &  other) const
inlineconstexprnoexcept

Inequality comparison operator.

Definition at line 48 of file SqlDate.hpp.

◆ Today()

static LIGHTWEIGHT_FORCE_INLINE SqlDate Lightweight::SqlDate::Today ( )
inlinestaticnoexcept

Returns the current date.

Definition at line 66 of file SqlDate.hpp.

◆ ConvertToSqlValue()

static LIGHTWEIGHT_FORCE_INLINE constexpr SQL_DATE_STRUCT Lightweight::SqlDate::ConvertToSqlValue ( std::chrono::year_month_day  value)
inlinestaticconstexprnoexcept

Converts a std::chrono::year_month_day to the underlying SQL date structure.

Definition at line 74 of file SqlDate.hpp.

References value().

Referenced by SqlDate().

◆ ConvertToNative()

static LIGHTWEIGHT_FORCE_INLINE constexpr std::chrono::year_month_day Lightweight::SqlDate::ConvertToNative ( SQL_DATE_STRUCT const &  value)
inlinestaticconstexprnoexcept

Converts a SQL date structure to std::chrono::year_month_day.

Definition at line 84 of file SqlDate.hpp.

References value().

Referenced by value().

Member Data Documentation

◆ sqlValue

SQL_DATE_STRUCT Lightweight::SqlDate::sqlValue {}

Holds the underlying SQL date structure.

Definition at line 20 of file SqlDate.hpp.

Referenced by operator==(), and value().


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