ORM C++
Loading...
Searching...
No Matches
orm::model Namespace Reference

Classes

struct  AutoIncrement
struct  ColumnName
 Compile-time override of one aggregate member's SQL column name. More...
struct  ColumnNames
struct  ColumnView
struct  JunctionView
struct  LogicalTypeTraits
struct  LogicalTypeTraits< bool >
struct  LogicalTypeTraits< char >
struct  LogicalTypeTraits< Date >
struct  LogicalTypeTraits< double >
struct  LogicalTypeTraits< float >
struct  LogicalTypeTraits< int >
struct  LogicalTypeTraits< LocalDateTime >
struct  LogicalTypeTraits< long >
struct  LogicalTypeTraits< long long >
struct  LogicalTypeTraits< short >
struct  LogicalTypeTraits< signed char >
struct  LogicalTypeTraits< std::string >
struct  LogicalTypeTraits< T >
struct  LogicalTypeTraits< TimeOfDay >
struct  LogicalTypeTraits< unsigned char >
struct  LogicalTypeTraits< unsigned int >
struct  LogicalTypeTraits< unsigned long >
struct  LogicalTypeTraits< unsigned long long >
struct  LogicalTypeTraits< unsigned short >
struct  LogicalTypeTraits< UtcTimestamp >
struct  LogicalTypeTraits< Uuid >
struct  ModelDataView
 Immutable data stored once for a model inside a closed schema. More...
struct  ModelView
 Trivially-copyable handle to one model in immutable Schema storage. More...
struct  PrimaryKey
struct  RelationView
struct  Schema
 A closed compile-time set of ORM models. More...
struct  SchemaView
 Immutable view over a statically materialized schema. More...
struct  StaticModel
 Materializes one aggregate model's complete scalar metadata in static storage. More...
struct  StringLength
struct  StringLengths
struct  TypeId
struct  UuidStorageDefinition
struct  UuidStorages

Enumerations

enum class  ColumnType {
  Bool , Char , UnsignedChar , Short ,
  UnsignedShort , Int , UnsignedInt , LongLong ,
  UnsignedLongLong , Float , Double , String ,
  Uuid , Date , TimeOfDay , LocalDateTime ,
  UtcTimestamp
}
enum class  RelationKind { ToOne , OneToMany , ManyToMany }
enum class  FieldKind { Scalar , ToOne }
enum class  UuidStorage { Native , Binary16 , Text36 }

Functions

auto toString (ColumnType type) -> std::string
template<auto Member, reflection::FixedString SqlName>
consteval auto columnName () -> ColumnName< Member, SqlName >
 Creates a typed SQL column-name override.
template<typename... Definitions>
consteval auto columnNames (Definitions...) -> ColumnNames< Definitions... >
 Groups typed SQL column-name overrides.
template<auto Member, std::size_t Length>
consteval auto stringLength () -> StringLength< Member, Length >
template<typename... Definitions>
consteval auto stringLengths (Definitions...) -> StringLengths< Definitions... >
template<auto... Members>
consteval auto primaryKey () -> PrimaryKey< Members... >
 Defines an ordered, typed primary key. An empty definition makes the model explicitly keyless.
template<auto... Members>
consteval auto autoIncrement () -> AutoIncrement< Members... >
 Defines typed auto-increment members. Static-model validation further restricts this to one non-null int primary-key member.
template<typename T>
consteval auto logicalType () -> ColumnType
 Resolves a C++ field type to its logical database type at compile time. Users may extend the closed set through LogicalTypeTraits<T>.
template<typename SchemaType, typename T>
consteval auto modelDescriptor () noexcept -> StaticModel< T, SchemaType >
template<typename SchemaType, typename T>
constexpr auto modelView () noexcept -> ModelView
template<typename T>
consteval auto tableName () -> std::string_view
template<typename SchemaType>
constexpr auto schemaView () noexcept -> const SchemaView &
template<typename SchemaType, typename T>
consteval auto requireSchemaModel () -> void
template<typename T>
consteval auto typeId () noexcept -> TypeId

Variables

template<typename T>
constexpr bool isNullable = detail::StaticOptionalTraits<std::remove_cvref_t<T>>::isOptional
constexpr auto noTargetModel = std::numeric_limits<std::size_t>::max()

Enumeration Type Documentation

◆ ColumnType

enum class orm::model::ColumnType
exportstrong
Enumerator
Bool 
Char 
UnsignedChar 
Short 
UnsignedShort 
Int 
UnsignedInt 
LongLong 
UnsignedLongLong 
Float 
Double 
String 
Uuid 
Date 
TimeOfDay 
LocalDateTime 
UtcTimestamp 

Definition at line 15 of file types.cppm.

◆ FieldKind

enum class orm::model::FieldKind
exportstrong
Enumerator
Scalar 
ToOne 

Definition at line 40 of file views.cppm.

◆ RelationKind

enum class orm::model::RelationKind
exportstrong
Enumerator
ToOne 
OneToMany 
ManyToMany 

Definition at line 46 of file types.cppm.

◆ UuidStorage

enum class orm::model::UuidStorage
exportstrong

Physical representation of a logical UUID for a selected backend.

Enumerator
Native 
Binary16 
Text36 

Definition at line 47 of file views.cppm.

Function Documentation

◆ autoIncrement()

template<auto... Members>
auto orm::model::autoIncrement ( ) -> AutoIncrement< Members... >
constevalexport

Defines typed auto-increment members. Static-model validation further restricts this to one non-null int primary-key member.

Definition at line 377 of file mapping.cppm.

◆ columnName()

template<auto Member, reflection::FixedString SqlName>
auto orm::model::columnName ( ) -> ColumnName< Member, SqlName >
constevalexport

Creates a typed SQL column-name override.

Definition at line 159 of file mapping.cppm.

◆ columnNames()

template<typename... Definitions>
auto orm::model::columnNames ( Definitions... ) -> ColumnNames< Definitions... >
constevalexport

Groups typed SQL column-name overrides.

Definition at line 222 of file mapping.cppm.

◆ logicalType()

template<typename T>
auto orm::model::logicalType ( ) -> ColumnType
constevalexport

Resolves a C++ field type to its logical database type at compile time. Users may extend the closed set through LogicalTypeTraits<T>.

Definition at line 528 of file mapping.cppm.

◆ modelDescriptor()

template<typename SchemaType, typename T>
auto orm::model::modelDescriptor ( ) -> StaticModel< T, SchemaType >
nodiscardconstevalexportnoexcept

Definition at line 114 of file schema.cppm.

◆ modelView()

template<typename SchemaType, typename T>
auto orm::model::modelView ( ) -> ModelView
nodiscardconstexprexportnoexcept

Definition at line 120 of file schema.cppm.

◆ primaryKey()

template<auto... Members>
auto orm::model::primaryKey ( ) -> PrimaryKey< Members... >
constevalexport

Defines an ordered, typed primary key. An empty definition makes the model explicitly keyless.

Definition at line 330 of file mapping.cppm.

◆ requireSchemaModel()

template<typename SchemaType, typename T>
auto orm::model::requireSchemaModel ( ) -> void
constevalexport

Definition at line 490 of file schema.cppm.

◆ schemaView()

template<typename SchemaType>
auto orm::model::schemaView ( ) -> const SchemaView &
nodiscardconstexprexportnoexcept

Definition at line 484 of file schema.cppm.

◆ stringLength()

template<auto Member, std::size_t Length>
auto orm::model::stringLength ( ) -> StringLength< Member, Length >
constevalexport

Definition at line 239 of file mapping.cppm.

◆ stringLengths()

template<typename... Definitions>
auto orm::model::stringLengths ( Definitions... ) -> StringLengths< Definitions... >
constevalexport

Definition at line 277 of file mapping.cppm.

◆ tableName()

template<typename T>
auto orm::model::tableName ( ) -> std::string_view
nodiscardconstevalexport

Definition at line 126 of file schema.cppm.

◆ toString()

auto orm::model::toString ( ColumnType type) -> std::string
export

◆ typeId()

template<typename T>
auto orm::model::typeId ( ) -> TypeId
constevalexportnoexcept

Definition at line 35 of file views.cppm.

Variable Documentation

◆ isNullable

template<typename T>
bool orm::model::isNullable = detail::StaticOptionalTraits<std::remove_cvref_t<T>>::isOptional
inlineconstexprexport

Definition at line 552 of file mapping.cppm.

◆ noTargetModel

auto orm::model::noTargetModel = std::numeric_limits<std::size_t>::max()
inlineconstexprexport

Definition at line 54 of file views.cppm.