5#include "../SqlColumnTypeDefinitions.hpp" 
   27    static std::optional<
SqlGuid> TryParse(std::string_view const& text) noexcept;
 
   30    static 
SqlGuid constexpr UnsafeParse(std::string_view const& text) noexcept;
 
   32    constexpr std::weak_ordering operator<=>(
SqlGuid const& other) const noexcept = default;
 
   34    constexpr 
bool operator==(
SqlGuid const& other) const noexcept
 
   36        return (*this <=> other) == std::weak_ordering::equivalent;
 
   39    constexpr bool operator!=(
SqlGuid const& other) 
const noexcept 
   41        return !(*
this == other);
 
   45    constexpr explicit operator bool() const noexcept
 
   47        return *
this != SqlGuid {};
 
   51    constexpr bool operator!() const noexcept
 
   53        return !
static_cast<bool>(*this);
 
 
   65    if (text.size() != 36)
 
   69    if (text[8] != 
'-' || text[13] != 
'-' || text[18] != 
'-' || text[23] != 
'-')
 
   73    auto const version = text[14];
 
   74    if (!(
'1' <= version && version <= 
'5'))
 
   78    auto const variant = text[21];
 
   79    if (variant != 
'8' && variant != 
'9' && variant != 
'A' && variant != 
'B' && variant != 
'a' && variant != 
'b')
 
   84    for (
auto const index: { 0, 2, 4, 6,
 
   88                             24, 26, 28, 30, 32, 34 })
 
   90        if (std::from_chars(text.data() + index, text.data() + index + 2, guid.data[i], 16).ec != std::errc())
 
 
  102struct std::formatter<Lightweight::SqlGuid>: std::formatter<std::string>
 
  104    LIGHTWEIGHT_FORCE_INLINE 
auto format(
Lightweight::SqlGuid const& guid, format_context& ctx) 
const 
  105        -> format_context::iterator
 
  108        return formatter<std::string>::format(std::format(
 
  109                "{:08X}-{:04X}-{:04X}-{:04X}-{:012X}",
 
  110                (uint32_t) guid.data[3] | (uint32_t) guid.data[2] << 8 |
 
  111                    (uint32_t) guid.data[1] << 16 | (uint32_t) guid.data[0] << 24,
 
  112                (uint16_t) guid.data[5] | (uint16_t) guid.data[4] << 8,
 
  113                (uint16_t) guid.data[7] | (uint16_t) guid.data[6] << 8,
 
  114                (uint16_t) guid.data[8] | (uint16_t) guid.data[9] << 8,
 
  115                (uint64_t) guid.data[15] | (uint64_t) guid.data[14] << 8 |
 
  116                    (uint64_t) guid.data[13] << 16 | (uint64_t) guid.data[12] << 24 |
 
  117                    (uint64_t) guid.data[11] << 32 | (uint64_t) guid.data[10] << 40
 
  128inline LIGHTWEIGHT_FORCE_INLINE std::string to_string(SqlGuid 
const& guid)
 
  130    return std::format(
"{}", guid);
 
  134struct LIGHTWEIGHT_API SqlDataBinder<SqlGuid>
 
  136    static constexpr auto ColumnType = SqlColumnTypeDefinitions::Guid {};
 
  138    static SQLRETURN InputParameter(SQLHSTMT stmt,
 
  140                                    SqlGuid 
const& value,
 
  141                                    SqlDataBinderCallback& cb) 
noexcept;
 
  143    static SQLRETURN OutputColumn(
 
  144        SQLHSTMT stmt, SQLUSMALLINT column, SqlGuid* result, SQLLEN* indicator, SqlDataBinderCallback& cb) 
noexcept;
 
  146    static SQLRETURN GetColumn(
 
  147        SQLHSTMT stmt, SQLUSMALLINT column, SqlGuid* result, SQLLEN* indicator, SqlDataBinderCallback 
const& cb) 
noexcept;
 
  149    static LIGHTWEIGHT_FORCE_INLINE std::string Inspect(SqlGuid 
const& value) 
noexcept 
  151        return std::format(
"{}", value);
 
static SqlGuid constexpr UnsafeParse(std::string_view const &text) noexcept
Parses a GUID from a string. Use with caution and always prefer TryParse at all cost.
static SqlGuid Create() noexcept
Creates a new non-empty GUID.