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.

find
auto find(Database db, int id)

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

from
QueryBuilderHelper!(T[]) from()

Undocumented in source. Be warned that the author may not have intended to support it.

generateCreateTableFor
string generateCreateTableFor()

Undocumented in source. Be warned that the author may not have intended to support it.

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.

parseDbTimestamp
SysTime parseDbTimestamp(Timestamp s)

Undocumented in source. Be warned that the author may not have intended to support it.

parseDbTimestamp
SysTime parseDbTimestamp(string s)

Undocumented in source. Be warned that the author may not have intended to support it.

save
void save(O t, Database db)
toTableName
string toTableName(string t)

Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

CASCADE
enum CASCADE;

Undocumented in source.

NULLIFY
enum NULLIFY;

Undocumented in source.

RESTRICT
enum RESTRICT;

Undocumented in source.

Structs

Constraint
struct Constraint(string sql)

Undocumented in source.

DBName
struct DBName

Undocumented in source.

Default
struct Default

Undocumented in source.

ForeignKey
struct ForeignKey(alias toWhat, string behavior)

Undocumented in source.

Index
struct Index(Fields...)

Undocumented in source.

Nullable
struct Nullable(T)

Undocumented in source.

PrimaryKey
struct PrimaryKey

Undocumented in source.

QueryBuilderHelper
struct QueryBuilderHelper(T)
Serial
struct Serial

Undocumented in source.

Timestamp
struct Timestamp

Undocumented in source.

Unique
struct Unique

Undocumented in source.

UniqueIndex
struct UniqueIndex(Fields...)

Undocumented in source.

Templates

where
template where(conditions...)

Meta