Skip to content

Commit ece9140

Browse files
committed
Add comprehensive DuckDB extension support and fix db.DB() method
Major Features Added: - Complete DuckDB extension management system - Support for loading, installing, and managing extensions - Extension helper with convenience methods for common use cases - Support for analytics, data formats, spatial, ML, and time series extensions - Comprehensive test coverage for all extension functionality Core Improvements: - Fixed db.DB() method access to underlying *sql.DB instance - Cleaned up package structure and removed conflicting files - Added proper error handling and validation - Following GORM coding standards and conventions Extension Features: - ExtensionManager for low-level extension operations - ExtensionHelper for high-level convenience methods - Auto-loading of extensions with preload configuration - Support for all major DuckDB extensions (JSON, Parquet, Spatial, etc.) - Proper extension status tracking and validation Technical Details: - Implemented proper GORM interfaces for extension support - Added extension-aware dialector variants - Comprehensive documentation and examples - Full test coverage with real DuckDB functionality testing Known Issues: - Time pointer conversion temporarily disabled (affects *time.Time fields) - Will be addressed in future release with proper wrapper implementation This release significantly enhances the DuckDB driver capabilities while maintaining full GORM compatibility.
1 parent 3095413 commit ece9140

File tree

9 files changed

+1839
-253
lines changed

9 files changed

+1839
-253
lines changed

CHANGELOG.md

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5,81 +5,6 @@ All notable changes to the GORM DuckDB driver will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.1.3] - 2025-06-22
9-
10-
### Fixed
11-
12-
- **Critical**: Fixed `db.DB()` method returning `nil` by implementing correct `GetDBConn()` interface
13-
- Added comprehensive test coverage for `db.DB()` method functionality
14-
- Resolved issue where external projects couldn't access underlying `*sql.DB` instance
15-
16-
### Changed
17-
18-
- Corrected interface method name from `GetDBConnector()` to `GetDBConn()` to match GORM expectations
19-
- Enhanced test suite with specific `db.DB()` method validation
20-
21-
### Technical Details
22-
23-
The connection pool wrapper now properly implements the `GetDBConn() (*sql.DB, error)` interface that GORM's `db.DB()` method expects. This resolves the critical issue where:
24-
25-
- `db.DB()` was returning `nil` instead of the underlying `*sql.DB` instance
26-
- External projects couldn't perform database cleanup or connection management
27-
- Integration tests failed when trying to close database connections
28-
29-
This fix ensures full compatibility with GORM's standard database access patterns.
30-
31-
## [0.1.2] - 2025-06-22
32-
33-
### Fixed
34-
35-
- **Code Quality**: Reduced cyclomatic complexity in key functions (`DataTypeOf`, `DefaultValueOf`, `QuoteTo`, `FullDataTypeOf`)
36-
- **Error Handling**: Fixed all unchecked error returns from writer operations
37-
- **Type Safety**: Resolved integer overflow concerns in size conversions
38-
- **Formatting**: Applied consistent code formatting with gofumpt
39-
- **Linting**: Addressed all golangci-lint issues including errcheck, gocritic, gosec, and staticcheck warnings
40-
41-
### Changed
42-
43-
- Refactored `DataTypeOf` function to use helper methods for better maintainability
44-
- Simplified `QuoteTo` function logic while maintaining functionality
45-
- Improved error handling throughout codebase with proper return value checking
46-
- Enhanced type switch optimization for better performance
47-
- Removed redundant embedded field selectors in migrator
48-
49-
### Technical Details
50-
51-
This release focuses on code quality improvements and linting compliance:
52-
53-
- Split complex functions into smaller, more manageable helper functions
54-
- Added proper error handling for all writer operations
55-
- Implemented type assertions and error checking best practices
56-
- Reduced cyclomatic complexity from 22+ to under 10 for all functions
57-
- Ensured all golangci-lint checks pass with zero issues
58-
59-
## [0.1.1] - 2025-06-22
60-
61-
### Fixed
62-
63-
- **Critical**: Fixed `db.DB()` method access issue by implementing `GetDBConnector()` interface in connection wrapper
64-
- Resolved "sql: unknown driver duckdb" error by adding proper DuckDB driver import
65-
- Cleaned up package conflicts and removed large binary files from repository
66-
- Updated `.gitignore` to prevent future binary commits
67-
68-
### Changed
69-
70-
- Improved connection pool wrapper to properly expose underlying `*sql.DB` instance
71-
- Enhanced example application with DB access testing
72-
- Updated import paths in example to use correct module reference
73-
74-
### Technical Details
75-
76-
The `duckdbConnPoolWrapper` now properly implements the interface needed for GORM to access the underlying `*sql.DB` through the `db.DB()` method. This enables:
77-
78-
- Connection pool configuration (`SetMaxIdleConns`, `SetMaxOpenConns`)
79-
- Database monitoring (`db.DB().Stats()`)
80-
- Health checks (`db.DB().Ping()`)
81-
- All other standard `*sql.DB` operations
82-
838
## [0.1.0] - 2025-06-22
849

8510
### Added

RELEASE.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
**Open an Issue in Main GORM Repo:**
3535

36-
- Repository: [https://github.com/go-gorm/]
36+
- Repository: https://github.com/go-gorm/gorm
3737
- Title: `[RFC] DuckDB Driver for GORM - Request for Feedback`
3838
- Content:
3939

@@ -69,4 +69,64 @@
6969

7070
The driver is ready for community testing. Looking forward to your thoughts!
7171
```
72-
72+
73+
### 2. Go Community Outreach
74+
75+
- **Reddit**: Post in /r/golang about the new driver
76+
- **Hacker News**: Share the repository
77+
- **Go Forums**: Announce in golang-nuts mailing list
78+
- **Twitter/X**: Tweet about the release with #golang #gorm #duckdb
79+
80+
### 3. DuckDB Community
81+
82+
- **DuckDB Discord**: Share in integrations channel
83+
- **DuckDB Discussions**: Post about Go/GORM integration
84+
85+
## Documentation for Release
86+
87+
### GitHub Release Notes Template
88+
89+
```markdown
90+
# GORM DuckDB Driver v0.1.0 🚀
91+
92+
First public release of the DuckDB driver for GORM!
93+
94+
## 🎯 What is this?
95+
A production-ready adapter that brings DuckDB's high-performance analytical capabilities to the GORM ecosystem. Perfect for data science, analytics, and high-throughput applications.
96+
97+
## ✨ Features
98+
- **Complete GORM Integration**: All dialector and migrator interfaces implemented
99+
- **Auto-increment Support**: Uses DuckDB sequences for ID generation
100+
- **Type Safety**: Comprehensive Go ↔ DuckDB type mapping
101+
- **Connection Pooling**: Optimized connection handling with time conversion
102+
- **Schema Introspection**: Full table, column, index, and constraint discovery
103+
- **Test Coverage**: 100% test pass rate with comprehensive test suite
104+
105+
## 🚀 Quick Start
106+
107+
```go
108+
import (
109+
"gorm.io/gorm"
110+
"github.com/greysquirr3l/gorm-duckdb-driver"
111+
)
112+
113+
db, err := gorm.Open(duckdb.Open("test.db"), &gorm.Config{})
114+
```
115+
116+
## 📊 Perfect For
117+
118+
- Data analytics and OLAP workloads
119+
- High-performance read operations
120+
- Data science applications
121+
- ETL pipelines
122+
- Analytical dashboards
123+
124+
## 🤝 Contributing
125+
126+
This project aims for inclusion in the official go-gorm organization.
127+
See CONTRIBUTING.md for development setup and guidelines.
128+
129+
## 📄 License
130+
131+
MIT License
132+
```

0 commit comments

Comments
 (0)