Constrains a type to be an assignment type, which associates an identifier with a value.
Requirements
Assignments are used in inserters and updaters to assign values to identifiers like columns, primary keys and indexes.
To create an assignment, use the assignment operator = on the identifier to assign a value or a placeholder. Consider the following entity type and its table definition:
struct MyEntity {
int id{};
std::string name;
};
#define SQT_COLUMN_FIELD(COLUMN_NAME, FIELD)
Defines a column that binds to the specified field of the entity type.
Definition table_definition.h:273
#define SQT_PRIMARY_KEY(...)
Defines a primary key with the specified columns.
Definition table_definition.h:608
#define SQT_TABLE_BEGIN(TABLE_NAME, ENTITY_TYPE)
Begins the definition of a table type for the specified entity type.
Definition table_definition.h:141
#define SQT_TABLE_END
Ends the definition of a table type.
Definition table_definition.h:854
#define SQT_INDEX(...)
Defines an index with auto-generated names based on the specified columns.
Definition table_definition.h:733
Examples of creating an inserter with assignments:
);
);
);
static constexpr auto MakeInserter() noexcept
Creates an inserter for inserting an entire entity into the database table.
Definition data_context.h:156
Represents a primary key for a table, which is a composite of one or more columns.
Definition primary_key.h:29
constexpr Placeholder _
A helper constant to create an expression containing a placeholder.
Definition placeholder.h:31
constexpr const auto & Table
A helper template to retrieve the singleton instance of the table type associated with an entity type...
Definition table_mapping.h:64
The sqt::Assignment<> class template satisfies this concept.
- See also
- sqt::Assignment<>
-
sqt::AssignmentOperator
-
sqt::ExpressionLike