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

#include <SqlTime.hpp>

Public Types

using native_type = std::chrono::hh_mm_ss< std::chrono::microseconds >
 The native C++ type for time representation.
 
using sql_type = SQL_SS_TIME2_STRUCT
 The SQL type used for ODBC binding.
 

Public Member Functions

constexpr SqlTime () noexcept=default
 Default constructor.
 
constexpr SqlTime (SqlTime &&) noexcept=default
 Move constructor.
 
constexpr SqlTimeoperator= (SqlTime &&) noexcept=default
 Move assignment operator.
 
constexpr SqlTime (SqlTime const &) noexcept=default
 Copy constructor.
 
constexpr SqlTimeoperator= (SqlTime const &) noexcept=default
 Copy assignment operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr native_type value () const noexcept
 Returns the native time value.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator== (SqlTime const &other) const noexcept
 Equality comparison operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr bool operator!= (SqlTime const &other) const noexcept
 Inequality comparison operator.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlTime (native_type value) noexcept
 Constructs a SqlTime from a native time value.
 
LIGHTWEIGHT_FORCE_INLINE constexpr SqlTime (std::chrono::hours hour, std::chrono::minutes minute, std::chrono::seconds second, std::chrono::microseconds micros={}) noexcept
 Constructs a SqlTime from hours, minutes, seconds, and optional microseconds.
 

Static Public Member Functions

static LIGHTWEIGHT_FORCE_INLINE constexpr sql_type ConvertToSqlValue (native_type value) noexcept
 Converts a native time value to the SQL representation.
 
static LIGHTWEIGHT_FORCE_INLINE constexpr native_type ConvertToNative (sql_type const &value) noexcept
 Converts a SQL time value to the native representation.
 

Public Attributes

sql_type sqlValue {}
 The underlying SQL value for ODBC binding.
 

Detailed Description

Stores the time (of the day) to efficiently write to or read from a database.

Definition at line 42 of file SqlTime.hpp.

Member Typedef Documentation

◆ native_type

using Lightweight::SqlTime::native_type = std::chrono::hh_mm_ss<std::chrono::microseconds>

The native C++ type for time representation.

Definition at line 45 of file SqlTime.hpp.

◆ sql_type

using Lightweight::SqlTime::sql_type = SQL_SS_TIME2_STRUCT

The SQL type used for ODBC binding.

Definition at line 49 of file SqlTime.hpp.

Constructor & Destructor Documentation

◆ SqlTime() [1/2]

LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlTime::SqlTime ( native_type  value)
inlineconstexprnoexcept

Constructs a SqlTime from a native time value.

Definition at line 89 of file SqlTime.hpp.

References ConvertToSqlValue(), and value().

◆ SqlTime() [2/2]

LIGHTWEIGHT_FORCE_INLINE constexpr Lightweight::SqlTime::SqlTime ( std::chrono::hours  hour,
std::chrono::minutes  minute,
std::chrono::seconds  second,
std::chrono::microseconds  micros = {} 
)
inlineconstexprnoexcept

Constructs a SqlTime from hours, minutes, seconds, and optional microseconds.

Definition at line 95 of file SqlTime.hpp.

Member Function Documentation

◆ value()

LIGHTWEIGHT_FORCE_INLINE constexpr native_type Lightweight::SqlTime::value ( ) const
inlineconstexprnoexcept

Returns the native time value.

Definition at line 71 of file SqlTime.hpp.

References ConvertToNative(), and sqlValue.

Referenced by ConvertToNative(), ConvertToSqlValue(), operator==(), and SqlTime().

◆ operator==()

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

Equality comparison operator.

Definition at line 77 of file SqlTime.hpp.

References value().

◆ operator!=()

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

Inequality comparison operator.

Definition at line 83 of file SqlTime.hpp.

◆ ConvertToSqlValue()

static LIGHTWEIGHT_FORCE_INLINE constexpr sql_type Lightweight::SqlTime::ConvertToSqlValue ( native_type  value)
inlinestaticconstexprnoexcept

Converts a native time value to the SQL representation.

Definition at line 104 of file SqlTime.hpp.

References value().

Referenced by SqlTime().

◆ ConvertToNative()

static LIGHTWEIGHT_FORCE_INLINE constexpr native_type Lightweight::SqlTime::ConvertToNative ( sql_type const &  value)
inlinestaticconstexprnoexcept

Converts a SQL time value to the native representation.

Definition at line 117 of file SqlTime.hpp.

References value().

Referenced by value().

Member Data Documentation

◆ sqlValue

sql_type Lightweight::SqlTime::sqlValue {}

The underlying SQL value for ODBC binding.

Definition at line 56 of file SqlTime.hpp.

Referenced by value().


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