ModelFormat.Field

Describes a field inside the Model class, which corresponds to a column inside the actual database table later. It's using a generic format that is only later used by the drivers to actually convert to SQL statements.

Members

Enums

DBType
enum DBType

List of different (generic) database column types.

Functions

foreignKeyAnnotations
DBAnnotation[] foreignKeyAnnotations()
Undocumented in source. Be warned that the author may not have intended to support it.
hasConstructValue
bool hasConstructValue()

Returns true if this field has a dorm.annotations.constructValue annotation.

hasDefaultValue
bool hasDefaultValue()
Undocumented in source. Be warned that the author may not have intended to support it.
hasFlag
bool hasFlag(AnnotationFlag q)

Returns true iff this field has the given AnnotationFlag assigned.

hasGeneratedDefaultValue
bool hasGeneratedDefaultValue()

Returns true if: - this field has some annotation that auto-generates a value if it's not provided in an insert statement, (@defaultValue, @autoCreateTime, @autoIncrement) - has a @constructValue annotation (which is handled in db.d) - is nullable (e.g. of type Nullable!T), which implies that null is the default value.

isBuiltinId
bool isBuiltinId()

Returns true if this field is the default id field defined in the dorm.model.Model super-class.

isForeignKey
bool isForeignKey()

Returns true iff this field has the ForeignKeyImpl annotation.

isNullable
bool isNullable()

Returns true if this field does not have the notNull AnnotationFlag assigned, otherwise false.

isPrimaryKey
bool isPrimaryKey()

Returns true iff this field has the primaryKey AnnotationFlag.

selectorColumnName
string selectorColumnName(string tableName)
Undocumented in source. Be warned that the author may not have intended to support it.
sourceReferenceName
string sourceReferenceName(string modelName)
Undocumented in source. Be warned that the author may not have intended to support it.
toPrettySourceString
string toPrettySourceString()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

humanReadableGeneratedDefaultValueTypes
string humanReadableGeneratedDefaultValueTypes;

Human-readable description how fields with auto-generated values (non-required values) can be specified.

Variables

annotations
DBAnnotation[] annotations;

List of different annotations defined in the source code, converted to a serializable format and also all implicit annotations such as Choices for enums.

columnName
string columnName;

The exact name of the column later used in the DB, not neccessarily corresponding to the D field name anymore.

definedAt
SourceLocation definedAt;

For debugging purposes this is the D source code location where this field is defined from. This can be used in error messages.

internalAnnotations
InternalAnnotation[] internalAnnotations;

List of annotations only relevant for internal use.

sourceColumn
string sourceColumn;

Name of the field inside the D source code.

sourceType
string sourceType;

D type stringof.

type
DBType type;

The generic column type that is later translated to a concrete SQL type by a driver.

Meta