RelationMixin

Provides static methods for easy access to RelationProxy for the type this is used in. For docs on all the methods see RelationProxy's own docs.

Members

Aliases

ProxyT
alias ProxyT = RelationProxy!Type
Undocumented in source.
Type
alias Type = typeof(this)
Undocumented in source.

Properties

all
Type[] all [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
first
Nullable!Type first [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
last
Nullable!Type last [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
relationProxy
ProxyT relationProxy [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

count
long count(string col)
Undocumented in source. Be warned that the author may not have intended to support it.
find
Type find(U param)
Undocumented in source. Be warned that the author may not have intended to support it.
findBy
Type findBy(U[string] filters)
Undocumented in source. Be warned that the author may not have intended to support it.
insert
Type insert(Type record)
Undocumented in source. Be warned that the author may not have intended to support it.
removeOne
auto removeOne(Tpk id)
Undocumented in source. Be warned that the author may not have intended to support it.
saveRecord
bool saveRecord(Type record)
Undocumented in source. Be warned that the author may not have intended to support it.
updateAll
auto updateAll(U[string] updates)
Undocumented in source. Be warned that the author may not have intended to support it.
updateOne
auto updateOne(Tpk id, U[string] values)
Undocumented in source. Be warned that the author may not have intended to support it.
where
ProxyT where(U[string] filters)
Undocumented in source. Be warned that the author may not have intended to support it.
where
ProxyT where(string filter, U params)
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

struct User
{
   mixin RelationMixin;

   @PK @serial int id;
   string username;
   ubyte[] password;
   int posts;
}

auto firstUser = User.where(...).first;
auto nUpdated = User.where(...).updateAll(["posts": 123]);
auto userCount = User.where(...).count;

Meta