dorm.api.db

Undocumented in source.

Public Imports

dorm.api.condition
public import dorm.api.condition;
Undocumented in source.

Members

Aliases

DBConnectOptions
alias DBConnectOptions = Algebraic!(SQLiteConnectOptions, PostgresConnectOptions, MySQLConnectOptions)

Configuration operation to connect to a database.

Functions

parseTomlConfig
T parseTomlConfig(string filename)

Reads filename from disk as text, then deserializes it from TOML to T.

unwrapRowResult
TSelect unwrapRowResult(ffi.DBRowHandle row)

Extracts the DBRowHandle, optionally using JoinInformation when joins were used, into the TSelect datatype. TSelect may be a DormPatch or the model T directly. This is mostly used internally. Expect changes to this API until there is a stable API.

unwrapRowResult
TSelect unwrapRowResult(ffi.DBRowHandle row, string placeholder)

Unwraps the row like the other unwrap methods, but prefixes all fields with <placeholder>_, so for example placeholder foo and field user would result in foo_user.

unwrapRowResult
TSelect unwrapRowResult(ffi.DBRowHandle row, JoinInformation ji)

Extracts the DBRowHandle, optionally using JoinInformation when joins were used, into the TSelect datatype. TSelect may be a DormPatch or the model T directly. This is mostly used internally. Expect changes to this API until there is a stable API.

Imports

DBBackend (from dorm.lib.ffi)
public import dorm.lib.ffi : DBBackend;
Undocumented in source.
DormPatch (from dorm.types)
public import dorm.types : DormPatch;
Undocumented in source.

Mixin templates

SetupDormRuntime
mixintemplate SetupDormRuntime(alias timeout = 10.seconds)

Sets up the DORM runtime that is required to use DORM (and its implementation library "RORM")

Static functions

select
SelectOperation!(DBType!(Selection), SelectType!(Selection)) select(DormDB db)
SelectOperation!(DBType!(Selection), SelectType!(Selection)) select(DormTransaction tx)

Starts a builder struct that can be used to SELECT (query) data from the database.

Structs

BareConfiguration
struct BareConfiguration

Helper struct for deserializeToml!BareConfiguration to simply parse the database.toml file without additional configuration.

ConditionBuilder
struct ConditionBuilder(T)

This is the type of the variable that is passed into the condition callback at runtime on the SelectOperation struct. It automatically mirrors all DORM fields that are defined on the passed-in T Model class.

ConditionBuilderField
struct ConditionBuilderField(T, ModelFormat.Field field)

Type that actually implements the condition building on a ConditionBuilder.

DormDB
struct DormDB

High-level wrapper around a database. Through the driver implementation layer this handles connection pooling and distributes work across a thread pool automatically.

DormTransaction
struct DormTransaction

Wrapper around a Database transaction. Most methods that can be used on a DormDB can also be used on a transaction.

ForeignModelConditionBuilderField
struct ForeignModelConditionBuilderField(ModelRef, ModelFormat.Field field)

Helper type to access sub-fields through ModelRef foreign key fields. Will join the foreign model table automatically if using any fields on there, other than the primary key, which can be read directly from the source.

ForeignModelOrderBuilderField
struct ForeignModelOrderBuilderField(ModelRef, ModelFormat.Field field)

Helper type to access sub-fields through ModelRef foreign key fields. Will join the foreign model table automatically if using any fields on there, other than the primary key, which can be read directly from the source.

MySQLConnectOptions
struct MySQLConnectOptions

MySQL specific connection options

NotConditionBuilder
struct NotConditionBuilder(T)

Helper type to quickly create field == false conditions for boolean fields.

OrderBuilder
struct OrderBuilder(T)

This is the type of the variable that is passed into the orderBy callback at runtime on the SelectOperation struct. It automatically mirrors all DORM fields that are defined on the passed-in T Model class.

OrderBuilderField
struct OrderBuilderField(T, ModelFormat.Field field)

Type that actually implements the asc/desc methods inside the orderBy callback. (OrderBuilder) Defaults to ascending.

PopulateBuilder
struct PopulateBuilder(T)

This is the type of the variable that is passed into the populate callback at runtime on the SelectOperation struct. It automatically mirrors all DORM fields that are defined on the passed-in T Model class.

PopulateBuilderField
struct PopulateBuilderField(ModelRef, ModelFormat.Field field)

Helper struct

PopulateRef
struct PopulateRef

Internal structure returned by the PopulateBuilder, which is passed to user code from the populate method on a SelectOperation. Internally this works by setting the include flag on the internal join info structure that either already exists because of previous condition or ordering operations or generates the join info structure on-demand.

PostgresConnectOptions
struct PostgresConnectOptions

Postgres specific connection options

RawRow
struct RawRow

Allows column access on a raw DB row as returned by db.rawSQL.

RawSQLIterator
struct RawSQLIterator

Helper struct that makes it possible to foreach over the rawSQL result.

RemoveOperation
struct RemoveOperation(T : Model)

This is the builder struct that's used for delete operations.

SQLiteConnectOptions
struct SQLiteConnectOptions

SQLite specific connection options

SelectOperation
struct SelectOperation(T, TSelect, bool hasWhere = false, bool hasOffset = false, bool hasLimit = false)

This is the builder struct that's used for select operations (queries)

UpdateOperation
struct UpdateOperation(T : Model, bool hasWhere = false)

This is the builder struct that's used for update operations.

Meta