dpq.attributes

Members

Aliases

FK
alias FK = foreignKey
Undocumented in source.
FKey
alias FKey = foreignKey
Undocumented in source.
PK
alias PK = PrimaryKey
Undocumented in source.
PKey
alias PKey = PrimaryKey
Undocumented in source.
PrimaryKey
alias PrimaryKey = PrimaryKeyAttribute
Undocumented in source.
attr
alias attr = attribute
Undocumented in source.
embed
deprecated alias embed = EmbedAttribute
Undocumented in source.
ignore
alias ignore = IgnoreAttribute
Undocumented in source.
relation
alias relation = RelationAttribute

@relation attribute -- specifies the relation/type name to be used for Connection's ORM functions. If none is set, dpq will default to the structure's name in lower_snake_case.

Enums

EmbedAttribute
enum EmbedAttribute
Undocumented in source.
IgnoreAttribute
enum IgnoreAttribute

Specifies that the member should be completely ignored as far as the DB is concerned.

PrimaryKeyAttribute
enum PrimaryKeyAttribute

@PK / @Pkey / @PrimaryKey attribute -- specifies that the member should be a PK. Coumpound PKs are not supported.

Functions

attribute
AttributeAttribute attribute(string name)

@attribute / @attr -- specifies the name of the attribute to be used.

suffix
ColumnSuffixAttribute suffix(string suffix)

Allows placing any text after the column definition when ensureSchema is ran.

type
PGTypeAttribute type(string type)

Specifies the type for the member, overrides any serialiser-provided type

Manifest constants

notNull
enum notNull;

A shortcut to @suffix("NOT NULL")

Properties

foreignKey
ForeignKeyAttribute foreignKey [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
index
IndexAttribute index [@property getter]

@index

serial
PGTypeAttribute serial [@property getter]

Shortcut for @type("SERIAL")

serial4
PGTypeAttribute serial4 [@property getter]

SHORTCUT for @type("SERIAL4")

serial8
PGTypeAttribute serial8 [@property getter]

SHORTCUT for @type("SERIAL8")

uniqueIndex
IndexAttribute uniqueIndex [@property getter]

@uniqueIndex

Structs

AttributeAttribute
struct AttributeAttribute
Undocumented in source.
ColumnSuffixAttribute
struct ColumnSuffixAttribute
Undocumented in source.
ForeignKeyAttribute
struct ForeignKeyAttribute

Specifies that the member is a foriegn key, ensureSchema will create a FK constraint as well as an index for it. Finds the referenced table's PK by itself.

IndexAttribute
struct IndexAttribute

Specifies that the member/column should have an index created on it. If unique is set, it well be a unique index.

PGTypeAttribute
struct PGTypeAttribute
Undocumented in source.
RelationAttribute
struct RelationAttribute
Undocumented in source.

Templates

AttributeList
template AttributeList(T, bool ignorePK = false, bool insert = false)
Undocumented in source.
AttributeList2
template AttributeList2(T, string prefix = "", string asPrefix = "", bool ignorePK = false, fields...)

Returns a list of Columns for all the given type's serialisable members, with their actual names as they're used in SQL.

SnakeCase
template SnakeCase(string str)

Transforms the given string into lower_snake_case at compile-time. Used for attribute and relation names and probably not very useful outside the library itself.

attributeName
template attributeName(alias R)

Attribute name for the given type, can be specified with @attribute. If @attribute is not specified, the member's name will just be lower_snake_cased and returned.

embeddedPrefix
deprecated template embeddedPrefix(T, string name)
Undocumented in source.
filterSerialisableMembers
template filterSerialisableMembers(T, fields...)

A filter implementation for serialisableMembers

getMembersByUDA
template getMembersByUDA(T, alias attribute)

Workaround for getSymbolsByUDA not working on structs/classes with private members. Returns all the structure's members that have the given UDA.

isNonStaticMember
template isNonStaticMember(T, string M)
Undocumented in source.
isPK
template isPK(alias T, string m)

Returns true if the member m is a PK on T.

isPublicMember
template isPublicMember(T, string M)
Undocumented in source.
isRWField
template isRWField(T, string M)

Determines if a member is a public, non-static, de-facto data field. In addition to plain data fields, R/W properties are also accepted.

isRWPlainField
template isRWPlainField(T, string M)

Determins if a member is a public, non-static data field.

primaryKeyAttributeName
template primaryKeyAttributeName(T)

Returns the name of the PK attribute (SQL name)

primaryKeyName
template primaryKeyName(T)

Returns a string containing the name of the type member that is marked with @PK

relationName
template relationName(alias R)

Relation/type name for the given type, can be set with @relation attribute. If @relation is not set, type's name will be lower_snake_cased.

serialisableMembers
template serialisableMembers(T)

Gives a list of all the structure's members that will be used in the DB. Ignores @ignore members, non-RW and non-public members.

Meta