SQT
A C++ ORM framework for SQLite
Loading...
Searching...
No Matches

◆ SQT_COLUMN_FIELD_DEFAULT

#define SQT_COLUMN_FIELD_DEFAULT ( COLUMN_NAME,
FIELD,
DEFAULT_VALUE )

Defines a column with a default value that binds to the specified field of the entity type.

Parameters
COLUMN_NAMEThe name of the column in the database. It will be also used as the instance name of the column.
FIELDThe field of the entity type to which the column is bound.
DEFAULT_VALUEThe default value of the column.

This macro is similar to the SQT_COLUMN_FIELD macro, except that it allows specifying a default value for the column.

Example usage:

struct MyEntity {
int id{};
std::string name;
};
SQT_TABLE_BEGIN(MyEntityTable, MyEntity)
SQT_COLUMN_FIELD_DEFAULT(Name, name, "default_name")
#define SQT_COLUMN_FIELD_DEFAULT(COLUMN_NAME, FIELD, DEFAULT_VALUE)
Defines a column with a default value that binds to the specified field of the entity type.
Definition table_definition.h:317
#define SQT_TABLE_BEGIN(TABLE_NAME, ENTITY_TYPE)
Begins the definition of a table type for the specified entity type.
Definition table_definition.h:147
#define SQT_TABLE_END
Ends the definition of a table type.
Definition table_definition.h:1091
See also
SQT_COLUMN_FIELD