Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ linters:
- gochecknoinits
path: filesql\.go
source: func init\(\)
- linters:
- staticcheck
path: driver/.*\.go
text: SA1019.*deprecated.*Go 1.8
- path: (.+)\.go$
text: fmt.Fprintf
- path: (.+)\.go$
Expand Down
2 changes: 0 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ filesql/
├── domain/ # Domain model layer
│ ├── model/ # Domain model definitions
│ └── repository/ # Repository interfaces
├── driver/ # SQLite driver implementation
├── testdata/ # Test data files
├── doc/ # Documentation
│ ├── ja/ # Japanese documentation
Expand All @@ -85,7 +84,6 @@ filesql/
### Directory Roles

- **domain/**: Layer containing business logic and domain models. Pure Go implementation without external dependencies
- **driver/**: SQLite driver interface and implementation. Provides database/sql compatible driver
- **testdata/**: Sample files such as CSV, TSV, LTSV used in tests
- **doc/**: Multi-language documentation with subdirectories for each language

Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Rather than maintaining duplicate code across both projects, we extracted the co
- 🔍 **SQLite3 SQL Interface** - Use SQLite3's powerful SQL dialect to query your files
- 📁 **Multiple File Formats** - Support for CSV, TSV, and LTSV files
- 🗜️ **Compression Support** - Automatically handles .gz, .bz2, .xz, and .zst compressed files
- 🌊 **Stream Processing** - Efficiently handles large files through streaming with configurable chunk sizes
- 📖 **Flexible Input Sources** - Support for file paths, directories, io.Reader, and embed.FS
- 🚀 **Zero Setup** - No database server required, everything runs in-memory
- 🌍 **Cross-Platform** - Works seamlessly on Linux, macOS, and Windows
- 💾 **SQLite3 Powered** - Built on the robust SQLite3 engine for reliable SQL processing
Expand Down Expand Up @@ -374,6 +376,39 @@ if err != nil {
}
```

#### Auto-Save Input Type Restrictions

**Important**: Auto-save behavior depends on your input data source:

- **File Paths** (`AddPath`, `AddPaths`): Supports both overwrite mode (empty string) and output directory
```go
// ✅ Overwrite original files
builder.AddPath("data.csv").EnableAutoSave("")

// ✅ Save to output directory
builder.AddPath("data.csv").EnableAutoSave("./backup")
```

- **io.Reader** (`AddReader`): **Only supports output directory mode**
```go
// ❌ Build error - overwrite mode not supported
builder.AddReader(reader, "table", model.FileTypeCSV).EnableAutoSave("")

// ✅ Must specify output directory
builder.AddReader(reader, "table", model.FileTypeCSV).EnableAutoSave("./output")
```

Comment on lines +392 to +400
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Docs reference internal symbol model.FileTypeCSV; use public API (likely filesql.FileTypeCSV).

End users shouldn't import internal packages. The snippet should reference an exported constant from the public package.

-  builder.AddReader(reader, "table", model.FileTypeCSV).EnableAutoSave("")
+  builder.AddReader(reader, "table", filesql.FileTypeCSV).EnableAutoSave("")
@@
-  builder.AddReader(reader, "table", model.FileTypeCSV).EnableAutoSave("./output")
+  builder.AddReader(reader, "table", filesql.FileTypeCSV).EnableAutoSave("./output")

If the exported identifier differs (e.g., filesql.CSV), adjust accordingly.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **io.Reader** (`AddReader`): **Only supports output directory mode**
```go
// ❌ Build error - overwrite mode not supported
builder.AddReader(reader, "table", model.FileTypeCSV).EnableAutoSave("")
// ✅ Must specify output directory
builder.AddReader(reader, "table", model.FileTypeCSV).EnableAutoSave("./output")
```
// ❌ Build error - overwrite mode not supported
builder.AddReader(reader, "table", filesql.FileTypeCSV).EnableAutoSave("")
// ✅ Must specify output directory
builder.AddReader(reader, "table", filesql.FileTypeCSV).EnableAutoSave("./output")
🤖 Prompt for AI Agents
In README.md around lines 392 to 400 the example references the internal symbol
model.FileTypeCSV; replace it with the exported public constant from the public
package (e.g., filesql.FileTypeCSV or filesql.CSV) and update the code snippet
import and usage accordingly — change the snippet to import the public package
(filesql) instead of model, use the correct exported identifier, and verify the
README compiles against the public API shown to avoid suggesting internal
package usage.

- **Filesystems** (`AddFS`): **Only supports output directory mode**
```go
// ❌ Build error - overwrite mode not supported
builder.AddFS(filesystem).EnableAutoSave("")

// ✅ Must specify output directory
builder.AddFS(filesystem).EnableAutoSave("./output")
```

This restriction exists because io.Reader and filesystem inputs don't have original file paths that can be overwritten. The builder will return an error at build time if you try to use overwrite mode with these input types.

### Manual Data Export (Alternative to Auto-Save)

If you prefer manual control over when to save changes to files instead of using auto-save:
Expand Down
Loading
Loading