Skip to content

Commit a67ce6d

Browse files
committed
Update to readme
1 parent a98bc45 commit a67ce6d

File tree

2 files changed

+50
-8
lines changed

2 files changed

+50
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,22 @@ This release brings **first-class array support** to the GORM DuckDB driver, mak
2323
### 🔧 Technical Implementation
2424

2525
#### Array Type System
26+
2627
```go
2728
type StringArray []string // Maps to TEXT[]
2829
type IntArray []int64 // Maps to BIGINT[]
2930
type FloatArray []float64 // Maps to DOUBLE[]
3031
```
3132

3233
#### GORM Integration
34+
3335
- Automatic schema migration with proper array column types
3436
- Full CRUD support (Create, Read, Update, Delete) for array fields
3537
- Type-safe operations with compile-time checking
3638
- Seamless marshaling/unmarshaling between Go and DuckDB array syntax
3739

3840
#### Database Features
41+
3942
- **Array Literals**: Automatic conversion to DuckDB format `['a', 'b', 'c']`
4043
- **Null Handling**: Proper nil array support
4144
- **Empty Arrays**: Correct handling of zero-length arrays
@@ -44,7 +47,8 @@ type FloatArray []float64 // Maps to DOUBLE[]
4447

4548
### 🎯 Usage Examples
4649

47-
#### Model Definition
50+
#### Model
51+
4852
```go
4953
type Product struct {
5054
ID uint `gorm:"primaryKey"`
@@ -56,6 +60,7 @@ type Product struct {
5660
```
5761

5862
#### Array Operations
63+
5964
```go
6065
// Create with arrays
6166
product := Product{
@@ -208,6 +213,7 @@ This ensures that **all** database operations, including those within transactio
208213
---
209214

210215
**Legend:**
216+
211217
- 🎉 Major Feature
212218
- ✨ Added
213219
- 🔧 Technical

README.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,35 @@ A comprehensive, production-ready DuckDB driver for [GORM](https://gorm.io), bri
3131

3232
### Install
3333

34+
**Step 1:** Add the dependencies to your project:
35+
3436
```bash
35-
go get -u gorm.io/driver/duckdb
3637
go get -u gorm.io/gorm
38+
go get -u github.com/greysquirr3l/gorm-duckdb-driver
39+
```
40+
41+
**Step 2:** Add a `replace` directive to your `go.mod` file:
42+
43+
```go
44+
module your-project
45+
46+
go 1.21
47+
48+
require (
49+
gorm.io/driver/duckdb v1.0.0
50+
gorm.io/gorm v1.25.12
51+
)
52+
53+
// Replace directive to use this implementation
54+
replace gorm.io/driver/duckdb => github.com/greysquirr3l/gorm-duckdb-driver v0.2.4
55+
```
56+
57+
> **📝 Note**: The `replace` directive is necessary because this driver uses the future official module path `gorm.io/driver/duckdb` but is currently hosted at `github.com/greysquirr3l/gorm-duckdb-driver`. This allows for seamless migration once this becomes the official GORM driver.
58+
59+
**Step 3:** Run `go mod tidy` to update dependencies:
60+
61+
```bash
62+
go mod tidy
3763
```
3864

3965
### Connect to Database
@@ -57,6 +83,20 @@ db, err := gorm.Open(duckdb.New(duckdb.Config{
5783
}), &gorm.Config{})
5884
```
5985

86+
### Alternative: Direct Import (Without Replace)
87+
88+
If you prefer to import directly without the replace directive:
89+
90+
```go
91+
import (
92+
duckdb "github.com/greysquirr3l/gorm-duckdb-driver"
93+
"gorm.io/gorm"
94+
)
95+
96+
// Usage remains the same
97+
db, err := gorm.Open(duckdb.Open(":memory:"), &gorm.Config{})
98+
```
99+
60100
## 🎨 Array Support (New!)
61101

62102
DuckDB's powerful array types are now fully supported with type safety:
@@ -280,7 +320,7 @@ duckdb.EnableDataFormatExtensions(db) // parquet, csv, json, etc.
280320

281321
## 🏗️ Architecture
282322

283-
```
323+
```ascii
284324
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
285325
│ Your Go App │───▶│ GORM Driver │───▶│ DuckDB │
286326
│ │ │ │ │ (Embedded) │
@@ -317,7 +357,7 @@ go test -v
317357

318358
```bash
319359
cd example
320-
go run main.go
360+
go run main.go # Run directly without building binary
321361
```
322362

323363
## 📄 License
@@ -335,7 +375,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
335375
- 🐛 **Issues**: [GitHub Issues](https://github.com/greysquirr3l/gorm-duckdb-driver/issues)
336376
- 💬 **Discussions**: [GitHub Discussions](https://github.com/greysquirr3l/gorm-duckdb-driver/discussions)
337377
- 📖 **Documentation**: [pkg.go.dev](https://pkg.go.dev/gorm.io/driver/duckdb)
338-
339-
---
340-
341-
**Made with ❤️ for the Go and DuckDB communities**

0 commit comments

Comments
 (0)