template<typename T>
class sqt::CustomValueTraits< T >
The primary template for defining traits for custom value types.
- Template Parameters
-
| T | The custom value type for which to define traits. |
This primary template is intended to be specialized by users for each custom value type. Specializing this template allows fields or accessors with custom value types to be used in column definitions via the SQT_COLUMN_FIELD or SQT_COLUMN_ACCESSOR macros.
Specializations must satisfy the sqt::BasicValueTraitsType concept. The following example demonstrates how to define a specialization for a custom value type mapped to the BLOB data type:
std::vector<std::byte> data;
};
namespace sqt {
template<>
public:
static constexpr bool IsNullable = false;
}
static BLOB RetrieveValue(
const sqt::Statement& statement,
int column_index) {
BLOB result;
result.data.assign(blob.begin(), blob.end());
return result;
}
};
}
The primary template for defining traits for custom value types.
Definition custom_value_traits.h:72
std::span< const std::byte > GetColumnBLOB(int column_index) const noexcept
Gets a span of bytes from the column at the specified index from the current selected row.
Definition statement.cpp:156
void BindParameter(int parameter_index, int value)
Binds the specified int value to the parameter at the specified index.
Definition statement.cpp:47
Wrapper class for SQLite statement.
Definition statement.h:21
DataType
Represents the type of data for an individual column.
Definition data_type.h:16
@ BLOB
Binary data type.
Definition data_type.h:36
- See also
- sqt::BasicValueTraitsType
-
SQT_COLUMN_ACCESSOR
-
SQT_COLUMN_FIELD