Std.App.Database
21 public declarations
- bundledDrivers
Array[Std.Db.Driver.Driver]Built-in connectors remain ordinary values that applications can extend.
- create
Str -> Int -> Result[Std.App.Database.Database, Std.Db.Driver.Error]Select a bundled connector from the connection-string scheme.
- Database
A backend-neutral resource shared by lifecycle callbacks and handlers.
- execute
&Std.App.Database.Database -> Str -> Result[Std.Db.Driver.Rows, Std.Db.Driver.Error]Run a statement that carries no values.
- fromConfig
&Std.App.Config.Config -> Str -> Int -> Result[Std.App.Database.Database, Std.Db.Driver.Error]Prepare a database from the connection string a setting names.
- fromConfigWith
Std.Db.Driver.Driver -> &Std.App.Config.Config -> Str -> Int -> Result[Std.App.Database.Database, Std.Db.Driver.Error]Prepare a database from a setting, using the given driver.
- migrate
&Std.App.Database.Database -> &Array[Std.Db.Migrate.Migration] -> Result[Int, Std.Db.Migrate.MigrationError]Bring the schema to what the program holds, through this database's driver.
- migrationStage
&Std.App.Database.Database -> Str -> &Array[Std.Db.Migrate.Migration] -> Std.App.Stage.StageA stage that migrates when the application starts and has nothing to undo
- query
&Std.App.Database.Database -> Str -> &Array[Std.Db.Driver.Value] -> Result[Std.Db.Driver.Rows, Std.Db.Driver.Error]SQL and placeholders follow the selected driver; values are always separate.
- queryAll
&Std.App.Database.Database -> Str -> &Array[Std.Db.Driver.Value] -> fn(Std.Db.Driver.Rows, Int) -> Result[T, Std.Db.Row.RowError] -> Result[Array[T], Std.App.Database.QueryError]Every row a query answered, each read by the mapper.
- QueryError
Preserve the distinction between database execution and application row decoding.
- queryOne
&Std.App.Database.Database -> Str -> &Array[Std.Db.Driver.Value] -> fn(Std.Db.Driver.Rows, Int) -> Result[T, Std.Db.Row.RowError] -> Result[T, Std.App.Database.QueryError]The single row a query answered, or an error when it answered none or several.
- queryOptional
&Std.App.Database.Database -> Str -> &Array[Std.Db.Driver.Value] -> fn(Std.Db.Driver.Rows, Int) -> Result[T, Std.Db.Row.RowError] -> Result[Option[T], Std.App.Database.QueryError]The one row a query answered, or nothing.
- readiness
&Std.App.Database.Database -> Str -> Std.App.Health.ReadinessA readiness check that asks the database a question.
- stage
&Std.App.Database.Database -> Str -> Std.App.Stage.StageAdd before stages that need the database; stage order determines dependency order.
- start
&Std.App.Database.Database -> Result[(), Std.Db.Driver.Error]Open the connections. Called by the stage rather than by a caller.
- stop
&Std.App.Database.Database -> Result[(), Std.Db.Driver.Error]Clear admission before closing; repeated stops are harmless.
- storeTarget
&Std.App.Database.Database -> Result[Std.Db.Store.Target, Std.Db.Driver.Error]This database as a store reads and writes it. A database that is not
- transaction
&Std.App.Database.Database -> fn(Std.Db.Driver.Tx) -> Result[Std.Db.Driver.Rows, Std.Db.Driver.Error] -> Result[Std.Db.Driver.Rows, Std.Db.Driver.Error]The selected driver owns the connection for the complete action.
- withDriver
Std.Db.Driver.Driver -> Str -> Int -> Result[Std.App.Database.Database, Std.Db.Driver.Error]Prepare any developer-supplied connector; sockets open during stage startup.
- withDrivers
&Array[Std.Db.Driver.Driver] -> Str -> Int -> Result[Std.App.Database.Database, Std.Db.Driver.Error]Select a connector from an explicit set, without a process-global registry.
