|
Lightweight 0.20260303.0
|
#include <SqlDateTime.hpp>
Public Types | |
| using | native_type = std::chrono::system_clock::time_point |
| The native C++ type representing a date-time value. | |
| using | duration_type = std::chrono::system_clock::duration |
| The duration type used for arithmetic operations. | |
Public Member Functions | |
| constexpr | SqlDateTime () noexcept=default |
| Default constructor. | |
| constexpr | SqlDateTime (SqlDateTime &&) noexcept=default |
| Default move constructor. | |
| constexpr SqlDateTime & | operator= (SqlDateTime &&) noexcept=default |
| Default move assignment operator. | |
| constexpr | SqlDateTime (SqlDateTime const &) noexcept=default |
| Default copy constructor. | |
| constexpr SqlDateTime & | operator= (SqlDateTime const &other) noexcept=default |
| Default copy assignment operator. | |
| constexpr std::weak_ordering | operator<=> (SqlDateTime const &other) const noexcept |
| Three-way comparison operator. | |
| constexpr bool | operator== (SqlDateTime const &other) const noexcept |
| Equality comparison operator. | |
| constexpr bool | operator!= (SqlDateTime const &other) const noexcept |
| Inequality comparison operator. | |
| LIGHTWEIGHT_FORCE_INLINE constexpr | SqlDateTime (std::chrono::year_month_day ymd, std::chrono::hh_mm_ss< duration_type > time) noexcept |
| Constructs a date and time from individual components. | |
| LIGHTWEIGHT_FORCE_INLINE constexpr | SqlDateTime (std::chrono::year year, std::chrono::month month, std::chrono::day day, std::chrono::hours hour, std::chrono::minutes minute, std::chrono::seconds second, std::chrono::nanoseconds nanosecond=std::chrono::nanoseconds(0)) noexcept |
| Constructs a date and time from individual components. | |
| LIGHTWEIGHT_FORCE_INLINE constexpr | SqlDateTime (std::chrono::system_clock::time_point value) noexcept |
| Constructs a date and time from a time point. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::year | year () const noexcept |
| Returns the year of this date-time object. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::month | month () const noexcept |
| Returns the month of this date-time object. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::day | day () const noexcept |
| Returns the day of this date-time object. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::hours | hour () const noexcept |
| Returns the hour of this date-time object. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::minutes | minute () const noexcept |
| Returns the minute of this date-time object. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::seconds | second () const noexcept |
| Returns the second of this date-time object. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE std::chrono::nanoseconds | nanosecond () const noexcept |
| Returns the nanosecond of this date-time object. | |
| LIGHTWEIGHT_FORCE_INLINE constexpr | operator native_type () const noexcept |
| Converts this SqlDateTime to its native time_point representation. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE SqlDate | Date () const noexcept |
| Constructs only a date from a SQL date-time structure. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE SqlTime | Time () const noexcept |
| Constructs only a time from a SQL date-time structure. | |
| constexpr LIGHTWEIGHT_FORCE_INLINE native_type | value () const noexcept |
| Returns the current date and time. | |
| LIGHTWEIGHT_FORCE_INLINE SqlDateTime & | operator+= (duration_type duration) noexcept |
| Adds a duration to this date-time. | |
| LIGHTWEIGHT_FORCE_INLINE SqlDateTime & | operator-= (duration_type duration) noexcept |
| Subtracts a duration from this date-time. | |
Static Public Member Functions | |
| static LIGHTWEIGHT_FORCE_INLINE SqlDateTime | Now () noexcept |
| Returns the current date and time. | |
| static LIGHTWEIGHT_FORCE_INLINE SqlDateTime | NowUTC () noexcept |
| Return the current date and time in UTC. | |
| static LIGHTWEIGHT_FORCE_INLINE SQL_TIMESTAMP_STRUCT constexpr | ConvertToSqlValue (native_type value) noexcept |
| Converts a native time_point to the underlying SQL timestamp structure. | |
| static LIGHTWEIGHT_FORCE_INLINE SQL_TIMESTAMP_STRUCT constexpr | ConvertToSqlValue (std::chrono::year_month_day ymd, std::chrono::hh_mm_ss< duration_type > hms) noexcept |
| Converts year_month_day and hh_mm_ss components to the underlying SQL timestamp structure. | |
| static LIGHTWEIGHT_FORCE_INLINE native_type constexpr | ConvertToNative (SQL_TIMESTAMP_STRUCT const &time) noexcept |
| Converts a SQL timestamp structure to the native time_point representation. | |
Public Attributes | |
| SQL_TIMESTAMP_STRUCT | sqlValue {} |
| Holds the underlying SQL timestamp structure. | |
Represents a date and time to efficiently write to or read from a database.
Definition at line 24 of file SqlDateTime.hpp.
| using Lightweight::SqlDateTime::native_type = std::chrono::system_clock::time_point |
The native C++ type representing a date-time value.
Definition at line 27 of file SqlDateTime.hpp.
| using Lightweight::SqlDateTime::duration_type = std::chrono::system_clock::duration |
The duration type used for arithmetic operations.
Definition at line 29 of file SqlDateTime.hpp.
|
inlineconstexprnoexcept |
Constructs a date and time from individual components.
Definition at line 75 of file SqlDateTime.hpp.
|
inlineconstexprnoexcept |
Constructs a date and time from individual components.
Definition at line 91 of file SqlDateTime.hpp.
References day(), hour(), minute(), month(), nanosecond(), second(), and year().
|
inlineconstexprnoexcept |
Constructs a date and time from a time point.
Definition at line 112 of file SqlDateTime.hpp.
References ConvertToSqlValue(), and value().
|
inlinestaticnoexcept |
Returns the current date and time.
Definition at line 32 of file SqlDateTime.hpp.
|
inlinestaticnoexcept |
Return the current date and time in UTC.
Definition at line 39 of file SqlDateTime.hpp.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Equality comparison operator.
Definition at line 63 of file SqlDateTime.hpp.
|
inlineconstexprnoexcept |
Inequality comparison operator.
Definition at line 69 of file SqlDateTime.hpp.
|
inlineconstexprnoexcept |
Returns the year of this date-time object.
Definition at line 120 of file SqlDateTime.hpp.
References sqlValue.
Referenced by Date(), and SqlDateTime().
|
inlineconstexprnoexcept |
Returns the month of this date-time object.
Definition at line 126 of file SqlDateTime.hpp.
References sqlValue.
Referenced by Date(), and SqlDateTime().
|
inlineconstexprnoexcept |
Returns the day of this date-time object.
Definition at line 132 of file SqlDateTime.hpp.
References sqlValue.
Referenced by Date(), and SqlDateTime().
|
inlineconstexprnoexcept |
Returns the hour of this date-time object.
Definition at line 138 of file SqlDateTime.hpp.
References sqlValue.
Referenced by SqlDateTime(), and Time().
|
inlineconstexprnoexcept |
Returns the minute of this date-time object.
Definition at line 144 of file SqlDateTime.hpp.
References sqlValue.
Referenced by SqlDateTime(), and Time().
|
inlineconstexprnoexcept |
Returns the second of this date-time object.
Definition at line 150 of file SqlDateTime.hpp.
References sqlValue.
Referenced by SqlDateTime(), and Time().
|
inlineconstexprnoexcept |
Returns the nanosecond of this date-time object.
Definition at line 156 of file SqlDateTime.hpp.
References sqlValue.
Referenced by SqlDateTime(), and Time().
|
inlineconstexprnoexcept |
Converts this SqlDateTime to its native time_point representation.
Definition at line 164 of file SqlDateTime.hpp.
References value().
|
inlineconstexprnoexcept |
Constructs only a date from a SQL date-time structure.
Definition at line 170 of file SqlDateTime.hpp.
|
inlineconstexprnoexcept |
Constructs only a time from a SQL date-time structure.
Definition at line 176 of file SqlDateTime.hpp.
References hour(), minute(), nanosecond(), and second().
|
inlinestaticconstexprnoexcept |
Converts a native time_point to the underlying SQL timestamp structure.
Definition at line 185 of file SqlDateTime.hpp.
References ConvertToSqlValue(), and value().
Referenced by ConvertToSqlValue(), and SqlDateTime().
|
inlinestaticconstexprnoexcept |
Converts year_month_day and hh_mm_ss components to the underlying SQL timestamp structure.
Definition at line 196 of file SqlDateTime.hpp.
|
inlinestaticconstexprnoexcept |
Converts a SQL timestamp structure to the native time_point representation.
Definition at line 214 of file SqlDateTime.hpp.
Referenced by value().
|
inlineconstexprnoexcept |
Returns the current date and time.
Definition at line 232 of file SqlDateTime.hpp.
References ConvertToNative(), and sqlValue.
Referenced by ConvertToSqlValue(), operator native_type(), operator+=(), operator-=(), operator<=>(), and SqlDateTime().
|
inlinenoexcept |
Adds a duration to this date-time.
Definition at line 238 of file SqlDateTime.hpp.
References value().
|
inlinenoexcept |
Subtracts a duration from this date-time.
Definition at line 245 of file SqlDateTime.hpp.
References value().
| SQL_TIMESTAMP_STRUCT Lightweight::SqlDateTime::sqlValue {} |
Holds the underlying SQL timestamp structure.
Definition at line 262 of file SqlDateTime.hpp.
Referenced by day(), hour(), minute(), month(), nanosecond(), second(), value(), and year().