arsd.database_generation

Helper functions for generating database stuff.

Note: this is heavily biased toward Postgres

Members

Classes

RecordNotFoundException
class RecordNotFoundException

Functions

associated
T associated(B base, Database db)

Finds the single row associated with a foreign key in base.

children
QueryBuilderHelper!(T[]) children(B base)

Gets all the children of that type. Specifically, it looks in T for a ForeignKey referencing B and queries on that.

insert
void insert(O t, Database db)
join
auto join()

It will return an aggregate row with a member of type of each table in the join.

save
void save(O t, Database db)

Static functions

find
auto find(Database db, int id)

Returns a given struct populated from the database. Assumes types known to this module.

Structs

QueryBuilderHelper
struct QueryBuilderHelper(T)

Templates

one_to_many
template one_to_many(alias fk_field, string t2 = null, string t1 = null)

generates get functions for a one-to-many relationship with the form T2 get_<t2>(T1 row, Database db) and TabResultSet!T1 get_<t1>(T2 row, Database db)

where
template where(conditions...)

Meta