diana_data library
Persistence for the Diana backend framework, built on the knex_dart
query builder.
Write a DatabaseConnector subclass that returns your driver connection,
inject Database into @Repository providers (or extend
DianaRepository with an abstract class and let Diana generate
Spring-Data-style query methods from their names), and wrap service
methods in @Transactional for ambient, savepoint-nesting transactions.
Diana opens the connection on startup, runs opt-in SQL migrations, and
closes it on graceful shutdown.
This is the only Diana package that depends on package:knex_dart
(enforced by a boundary test); the driver package is yours to choose.
Classes
- Database
- The injectable query executor. Repositories receive it via constructor injection; the generated composition root wires it and manages its lifecycle (open on startup, close on shutdown).
- DatabaseConnector
-
Bridges Diana to a concrete
knex_dartdriver. - DatabaseHealthIndicator
-
A
HealthIndicatorthat reports database connectivity by running a trivial query. Register it as a provider (@Component) and it is picked up by Diana's/actuator/healthendpoint like any other indicator. -
DianaRepository<
T> - Base class for Diana query repositories (Spring Data style).