Common connection pool management utilities.
Common connection pool management utilities.
Common database operations - main coordination module.
This namespace serves as the main coordinator for common database functionality, bringing together specialized modules for different aspects of database operations that work across all adapter types.
The common functionality has been refactored into specialized namespaces:
Pure query building functions are now in wagoe.platform.core.database.query
This modular structure provides:
Common database operations - main coordination module. This namespace serves as the main coordinator for common database functionality, bringing together specialized modules for different aspects of database operations that work across all adapter types. The common functionality has been refactored into specialized namespaces: - common.connection: Connection pool management with HikariCP - common.execution: Query execution with logging and error handling - common.schema: Schema introspection and DDL execution - common.utils: Database information and convenience functions - common.core: Main coordination module (this namespace) Pure query building functions are now in wagoe.platform.core.database.query This modular structure provides: - Better organization with focused responsibilities - Easier maintenance and testing - Consistent patterns across all database adapters - Clear separation of concerns
Query execution with I/O, logging, and error handling.
This is part of the imperative shell - it performs database I/O, manages transactions, and handles side effects like logging.
Query execution with I/O, logging, and error handling. This is part of the imperative shell - it performs database I/O, manages transactions, and handles side effects like logging.
Common query building and formatting utilities.
Common query building and formatting utilities.
Common schema management and DDL utilities.
Common schema management and DDL utilities.
Common database utilities and information functions.
Common database utilities and information functions.
Configuration-driven database adapter management.
This namespace provides functionality to read database configuration from config.edn and only load adapters that are marked as :active. This allows for optimized deployments where only required database drivers are loaded.
Key Features:
Usage: (require '[wagoe.platform.shell.adapters.database.config :as db-config])
(db-config/get-active-adapters "dev") ; Get active adapters for dev env (db-config/adapter-active? :postgresql) ; Check if adapter is active
Configuration-driven database adapter management. This namespace provides functionality to read database configuration from config.edn and only load adapters that are marked as :active. This allows for optimized deployments where only required database drivers are loaded. Key Features: - Configuration-driven adapter loading - Environment-specific database configs - Graceful handling of inactive adapters - JDBC driver optimization (only load needed drivers) Usage: (require '[wagoe.platform.shell.adapters.database.config :as db-config]) (db-config/get-active-adapters "dev") ; Get active adapters for dev env (db-config/adapter-active? :postgresql) ; Check if adapter is active
Configuration-driven database adapter factory.
This namespace provides factory functions that only load database adapters that are marked as :active in the configuration files. This enables optimized deployments where only necessary JDBC drivers are loaded and initialized.
Key Features:
Usage: (require '[wagoe.platform.shell.adapters.database.config-factory :as cf])
;; Load only active adapters for current environment (cf/create-active-contexts)
;; Create specific adapter context from config (cf/create-config-context "dev" :wagoe/sqlite)
Configuration-driven database adapter factory. This namespace provides factory functions that only load database adapters that are marked as :active in the configuration files. This enables optimized deployments where only necessary JDBC drivers are loaded and initialized. Key Features: - Only loads adapters marked as :active in config.edn - Graceful error handling for inactive adapters - Environment-aware adapter loading - Automatic configuration validation - JDBC driver optimization Usage: (require '[wagoe.platform.shell.adapters.database.config-factory :as cf]) ;; Load only active adapters for current environment (cf/create-active-contexts) ;; Create specific adapter context from config (cf/create-config-context "dev" :wagoe/sqlite)
Factory functions for database adapter creation and configuration.
This namespace provides convenient factory functions for creating database adapters, data sources, and database contexts. It supports multiple database types (SQLite, PostgreSQL, MySQL, H2) through a unified configuration interface.
Key Features:
Usage: (require '[wagoe.platform.shell.adapters.database.factory :as dbf])
(def ctx (dbf/db-context {:adapter :sqlite :database-path "./app.db"})) (db/execute-query! ctx {:select [:*] :from [:users]})
Factory functions for database adapter creation and configuration.
This namespace provides convenient factory functions for creating database
adapters, data sources, and database contexts. It supports multiple database
types (SQLite, PostgreSQL, MySQL, H2) through a unified configuration interface.
Key Features:
- Database adapter creation from configuration
- Connection pool and datasource management
- Database context creation with adapter + datasource
- Resource management with automatic cleanup
- Configuration validation and error handling
Usage:
(require '[wagoe.platform.shell.adapters.database.factory :as dbf])
(def ctx (dbf/db-context {:adapter :sqlite :database-path "./app.db"}))
(db/execute-query! ctx {:select [:*] :from [:users]})H2 connection management utilities.
H2 connection management utilities.
H2 database adapter - main entry point implementing the DBAdapter protocol.
This namespace serves as the main entry point for H2 database functionality, implementing the DBAdapter protocol and coordinating specialized modules for different aspects of H2 operations.
The adapter has been refactored into 5 specialized namespaces:
Key Features:
H2-Specific Optimizations:
H2 database adapter - main entry point implementing the DBAdapter protocol. This namespace serves as the main entry point for H2 database functionality, implementing the DBAdapter protocol and coordinating specialized modules for different aspects of H2 operations. The adapter has been refactored into 5 specialized namespaces: - h2.connection: Connection management and H2-specific settings - h2.query: H2-specific query building and boolean handling - h2.metadata: Table introspection and schema information - h2.utils: Utility functions and DDL helpers - h2.core: Main adapter implementation and coordination (this namespace) Key Features: - PostgreSQL compatibility mode for easier migration - In-memory databases for fast testing - File-based databases for development - Standard SQL features with good performance - Native boolean support (no conversion needed) H2-Specific Optimizations: - PostgreSQL compatibility mode by default - Proper timezone handling - Case-insensitive identifiers for compatibility - Optimized connection pool settings for embedded usage
H2 metadata and table introspection utilities.
H2 metadata and table introspection utilities.
H2 query building utilities.
H2 query building utilities.
H2 utility functions and DDL helpers.
H2 utility functions and DDL helpers.
Example integration showing how to use the multi-database adapter system.
This namespace demonstrates how to:
Example integration showing how to use the multi-database adapter system. This namespace demonstrates how to: - Load environment-specific configurations - Initialize database adapters based on active configurations - Use the initialized adapters for database operations - Handle multiple active databases simultaneously
MySQL connection management utilities.
MySQL connection management utilities.
MySQL database adapter implementing the DBAdapter protocol.
This namespace provides MySQL-specific functionality for production database deployments. MySQL is a widely-used, reliable relational database system with good performance and broad compatibility.
Key Features:
The adapter delegates to specialized modules for:
MySQL database adapter implementing the DBAdapter protocol. This namespace provides MySQL-specific functionality for production database deployments. MySQL is a widely-used, reliable relational database system with good performance and broad compatibility. Key Features: - LIKE-based string matching (case-insensitive by default) - Boolean values stored as TINYINT(1) - Robust connection handling with proper SSL configuration - Timezone and SQL mode configuration for consistency - Connection pool tuning for server workloads The adapter delegates to specialized modules for: - Connection management (mysql.connection) - Query building (mysql.query) - Metadata operations (mysql.metadata) - Utility functions (mysql.utils)
MySQL metadata and table introspection utilities.
MySQL metadata and table introspection utilities.
MySQL query building utilities.
MySQL query building utilities.
MySQL utility functions and DDL helpers.
MySQL utility functions and DDL helpers.
PostgreSQL connection management utilities.
PostgreSQL connection management utilities.
PostgreSQL database adapter implementing the DBAdapter protocol.
This namespace provides PostgreSQL-specific functionality for production database deployments. PostgreSQL is a powerful, open-source relational database system with advanced features and excellent performance.
Key Features:
The adapter delegates to specialized modules for:
PostgreSQL database adapter implementing the DBAdapter protocol. This namespace provides PostgreSQL-specific functionality for production database deployments. PostgreSQL is a powerful, open-source relational database system with advanced features and excellent performance. Key Features: - Case-insensitive string matching with ILIKE - Native boolean support - Advanced SQL features and data types - Robust transaction support - Excellent performance and scalability The adapter delegates to specialized modules for: - Connection management (postgresql.connection) - Query building (postgresql.query) - Metadata operations (postgresql.metadata) - Utility functions (postgresql.utils)
PostgreSQL metadata and table introspection utilities.
PostgreSQL metadata and table introspection utilities.
PostgreSQL query building utilities.
PostgreSQL query building utilities.
PostgreSQL utility functions and DDL helpers.
PostgreSQL utility functions and DDL helpers.
Protocol defining the common interface for database adapters.
This protocol abstracts database-specific behavior while allowing common database operations to be implemented in a shared core namespace. Each database type (SQLite, PostgreSQL, MySQL, H2) implements this protocol to provide database-specific functionality.
Design Philosophy:
Protocol defining the common interface for database adapters. This protocol abstracts database-specific behavior while allowing common database operations to be implemented in a shared core namespace. Each database type (SQLite, PostgreSQL, MySQL, H2) implements this protocol to provide database-specific functionality. Design Philosophy: - Keep protocol narrow - prefer common behavior in core - Only include methods that differ between databases - Database-agnostic operations belong in core namespace - Type conversions use shared utilities where possible
SQLite connection management utilities.
SQLite connection management utilities.
SQLite database adapter - main entry point implementing the DBAdapter protocol.
This namespace serves as the main entry point for SQLite database functionality, implementing the DBAdapter protocol and coordinating specialized modules for different aspects of SQLite operations.
The adapter has been refactored into 5 specialized namespaces:
Key Features:
SQLite-Specific Optimizations:
This namespace maintains backward compatibility by serving as the main entry point that other code can require directly.
SQLite database adapter - main entry point implementing the DBAdapter protocol. This namespace serves as the main entry point for SQLite database functionality, implementing the DBAdapter protocol and coordinating specialized modules for different aspects of SQLite operations. The adapter has been refactored into 5 specialized namespaces: - sqlite.connection: Connection management and PRAGMA settings - sqlite.query: SQLite-specific query building and boolean conversion - sqlite.metadata: Table introspection and schema information - sqlite.utils: Utility functions and DDL helpers - sqlite.core: Main adapter implementation and coordination (this namespace) Key Features: - SQLite-optimized connection management with PRAGMAs - Database-specific query building (LIKE for strings, boolean->int) - Schema introspection via sqlite_master and PRAGMA table_info - Integration with shared type conversion utilities SQLite-Specific Optimizations: - Text-based UUID and timestamp storage - Boolean as integer (0/1) representation - WAL mode, synchronous settings, and other PRAGMAs - Connection pool tuning for embedded usage This namespace maintains backward compatibility by serving as the main entry point that other code can require directly.
SQLite metadata and table introspection utilities.
SQLite metadata and table introspection utilities.
SQLite query building utilities.
SQLite query building utilities.
SQLite utility functions and DDL helpers.
SQLite utility functions and DDL helpers.
Dynamic JDBC driver loading based on active database configurations.
This namespace provides configuration-driven driver loading that eliminates the need to coordinate between configuration files and command-line aliases. Drivers are loaded dynamically based on which databases are marked as :active in the configuration files.
Key Features:
Usage: (require '[wagoe.platform.shell.adapters.database.utils.driver-loader :as dl])
;; Load drivers for active databases in current environment (dl/load-required-drivers!)
;; Load drivers for specific environment (dl/load-drivers-for-environment! "dev")
Dynamic JDBC driver loading based on active database configurations. This namespace provides configuration-driven driver loading that eliminates the need to coordinate between configuration files and command-line aliases. Drivers are loaded dynamically based on which databases are marked as :active in the configuration files. Key Features: - Single source of truth: configuration files control everything - Clear error messages when drivers are missing - Automatic driver detection from active databases - No command-line alias coordination required Usage: (require '[wagoe.platform.shell.adapters.database.utils.driver-loader :as dl]) ;; Load drivers for active databases in current environment (dl/load-required-drivers!) ;; Load drivers for specific environment (dl/load-drivers-for-environment! "dev")
Schema-to-DDL generation utilities for database adapters.
This namespace provides utilities for generating database DDL statements from Malli schema definitions. It handles:
Key Features:
Usage: (require '[wagoe.platform.shell.adapters.database.utils.schema :as schema])
(schema/generate-table-ddl ctx "users" some-malli-schema) (schema/initialize-tables-from-schemas! ctx schema-map)
Schema-to-DDL generation utilities for database adapters. This namespace provides utilities for generating database DDL statements from Malli schema definitions. It handles: - Column type mapping based on database dialect - Table creation with constraints - Index generation from schema analysis - Cross-database compatibility Key Features: - Uses Malli schemas as canonical source of truth - Database-specific column type mapping - Foreign key and unique constraint generation - Automatic index creation based on field patterns Usage: (require '[wagoe.platform.shell.adapters.database.utils.schema :as schema]) (schema/generate-table-ddl ctx "users" some-malli-schema) (schema/initialize-tables-from-schemas! ctx schema-map)
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |