-
-
Notifications
You must be signed in to change notification settings - Fork 17
Switch to mattn sqlite library #240
New issue
8000 Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR switches the SQLite driver from modernc.org/sqlite to github.com/mattn/go-sqlite3 for performance improvements while also updating various Task and Docker configurations. Key changes include:
- Updating database connection calls in userdb.go and mediadb.go to use the "sqlite3" driver.
- Adjusting numerous YAML task files to replace legacy variables (ARCH) with DOCKER_PLATFORM and updating Docker command arguments.
- Removing the Python-based makezip script in favor of a Go-based implementation.
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
scripts/tasks/*.yml (multiple files) | Updated DOCKERFILE paths and replaced ARCH with DOCKER_PLATFORM |
pkg/database/userdb/userdb.go | Changed SQLite driver and connection string from "sqlite" to "sqlite3" |
pkg/database/mediadb/mediadb.go | Changed SQLite driver and connection string from "sqlite" to "sqlite3" |
pkg/api/methods/media.go | Added logging for media DB generation duration |
go.mod | Removed modernc SQLite dependencies and added mattn/go-sqlite3 |
docs/index.md | Updated dependency and build environment notes |
Taskfile.dist.yml | Adjusted environment variable definitions |
.github/workflows/build.yml | Modified conditional steps for cross-platform builds |
scripts/cross/Dockerfile | New Dockerfile using Ubuntu and installing Zig and macOS SDK |
Comments suppressed due to low confidence (3)
scripts/tasks/docker.yml:12
- The updated Docker build command now uses the DOCKER_PLATFORM variable instead of DOCKER_ARCH. Confirm that this change is consistent across all task files and that any references to the old variable are updated accordingly.
docker build {{if .DOCKER_PLATFORM}}--platform {{.DOCKER_PLATFORM}}{{end}} ...
pkg/database/userdb/userdb.go:39
- The SQLite driver name has been updated to "sqlite3" to match the mattn/go-sqlite3 library. Please verify that any DSN or driver-specific configuration elsewhere in the project remains compatible with this change.
sqlInstance, err := sql.Open("sqlite3", dbPath)
pkg/database/mediadb/mediadb.go:43
- Ensure that switching the driver from modernc.org/sqlite to mattn/go-sqlite3 maintains the expected behavior for your database interactions, noting any subtle differences in connection or error handling.
sqlInstance, err := sql.Open("sqlite3", dbPath)
docs/index.md
Outdated
@@ -2,18 +2,17 @@ | |||
|
|||
## Environment | |||
|
|||
Zaparoo Core is written in Go, uses Task and Python for build scripts, and Docker for building all platforms which use Cgo. | |||
Zaparoo Core is written in Go, uses Task for build scripts, and Docker for building all platforms. All builds require Cgo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the switch to the mattn/go-sqlite3 library introduces a CGO dependency, consider expanding the documentation to clearly outline the additional build prerequisites for Windows and Mac environments.
Copilot uses AI. Check for mistakes.
This works and it gives a decent speed increase, but it also opens a whole kettle of fish about needing CGO and GCC in the Windows and Mac build environments, which is complicated from the CI.