digitaltwin-core
Version:
Minimalist framework to collect and handle data in a Digital Twin project
46 lines • 1.58 kB
JavaScript
/**
* @fileoverview Database abstraction layer for digital twin data persistence
*
* This module defines the abstract DatabaseAdapter interface that provides
* unified database operations across different database backends (SQLite, PostgreSQL).
* Implementations handle component data storage, metadata management, and querying.
*/
/**
* Abstract database adapter providing unified data operations for all components.
*
* DatabaseAdapter defines the contract for database operations used throughout the
* digital twin system. Implementations provide concrete database access using specific
* backends (SQLite, PostgreSQL) while maintaining a consistent API.
*
* The adapter handles:
* - Table creation and schema migration for components
* - CRUD operations for collected data and assets
* - Time-based and count-based queries for harvesters
* - Custom table operations for CustomTableManager components
*
* @abstract
* @class DatabaseAdapter
*
* @example
* ```typescript
* // Using KnexDatabaseAdapter (concrete implementation)
* const database = KnexDatabaseAdapter.forSQLite({
* filename: './data/digitaltwin.db'
* }, storage)
*
* // Save collector data
* await database.save({
* name: 'weather-collector',
* type: 'application/json',
* url: await storage.save(buffer, 'weather-collector'),
* date: new Date()
* })
*
* // Query latest data
* const latest = await database.getLatestByName('weather-collector')
* const data = await latest?.data()
* ```
*/
export class DatabaseAdapter {
}
//# sourceMappingURL=database_adapter.js.map