SimpleDataObject

This creates an editable data object out of a simple struct.

struct MyFields { int id; string name; }

alias SimpleDataObject!("my_table", MyFields) User;

More...
class SimpleDataObject : DataObject (
string tableToUse
fieldsToUse
) {}

Constructors

this
this(Database db)
Undocumented in source.

Members

Mixins

__anonymous
mixin StrictDataObject!()
Undocumented in source.

Inherited Members

From DataObject

makeJsonValue
JSONValue makeJsonValue()
Undocumented in source. Be warned that the author may not have intended to support it.
table
string table;
Undocumented in source.
mappings
Tuple!(string, string)[string] mappings;
Undocumented in source.
multiTableKeys
string[string][string] multiTableKeys;
Undocumented in source.
opDispatch
string opDispatch()
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
string opDispatch(T t)
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
string opDispatch(...)
Undocumented in source. Be warned that the author may not have intended to support it.
setWithoutChange
void setWithoutChange(string field, string value)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref string) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opApply
int opApply(int delegate(ref string, ref string) dg)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
string opIndex(string field, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndexAssign
string opIndexAssign(string value, string field)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
string* opBinary(string key)
Undocumented in source. Be warned that the author may not have intended to support it.
fields
string[string] fields;
Undocumented in source.
changed
bool[string] changed;
Undocumented in source.
commitChanges
void commitChanges()
Undocumented in source. Be warned that the author may not have intended to support it.
commitChanges
void commitChanges(string key, string keyField)
Undocumented in source. Be warned that the author may not have intended to support it.
commitChanges
void commitChanges(string[] keys, string[] keyFields)
Undocumented in source. Be warned that the author may not have intended to support it.
commitDelete
void commitDelete()
Undocumented in source. Be warned that the author may not have intended to support it.
getAlias
string getAlias(string table, string column)
Undocumented in source. Be warned that the author may not have intended to support it.
set
void set(string table, string column, string value)
Undocumented in source. Be warned that the author may not have intended to support it.
select
string select(string table, string column)
Undocumented in source. Be warned that the author may not have intended to support it.
addNew
DataObject addNew()
Undocumented in source. Be warned that the author may not have intended to support it.
db
Database db;
Undocumented in source.
mode
UpdateOrInsertMode mode;
Undocumented in source.

Detailed Description

User a = new User(db);

a.id = 30; a.name = "hello"; a.commitChanges(); // tries an update or insert on the my_table table

Unlike the base DataObject class, this template provides compile time checking for types and names, based on the struct you pass in:

a.id = "aa"; // compile error

a.notAField; // compile error

Meta