summaryrefslogtreecommitdiff
path: root/internal/storage/sqlite_nocgo.go
diff options
context:
space:
mode:
authorClaudomator Agent <agent@claudomator.local>2026-03-22 00:56:54 +0000
committerClaudomator Agent <agent@claudomator.local>2026-03-22 00:56:54 +0000
commit5081b0c014d8e82e7be1907441c246fbd01ca21e (patch)
treef4edc753c085e2c2f08e37b5aa52f909adbe379c /internal/storage/sqlite_nocgo.go
parent0bed6ec4377dd47b414d975304ae5bfae5d2b4c0 (diff)
feat: Phase 3 — stories data model, ValidStoryTransition, storage CRUD, API endpoints
- internal/task/story.go: Story struct, StoryState constants, ValidStoryTransition - internal/task/task.go: add StoryID field - internal/storage/db.go: stories table + story_id on tasks migrations; CreateStory, GetStory, ListStories, UpdateStoryStatus, ListTasksByStory; update all task SELECT/INSERT to include story_id; scanTask extended with sql.NullString for story_id; added modernc timestamp format to GetMaxUpdatedAt - internal/storage/sqlite_cgo.go + sqlite_nocgo.go: build-tag based driver selection (mattn/go-sqlite3 with CGO, modernc.org/sqlite pure-Go fallback) so tests run without a C compiler - internal/api/stories.go: GET/POST /api/stories, GET /api/stories/{id}, GET/POST /api/stories/{id}/tasks (auto-wires depends_on chain), PUT /api/stories/{id}/status (validates transition) - internal/api/server.go: register all story routes - go.mod/go.sum: add modernc.org/sqlite pure-Go dependency Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/storage/sqlite_nocgo.go')
-rw-r--r--internal/storage/sqlite_nocgo.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/storage/sqlite_nocgo.go b/internal/storage/sqlite_nocgo.go
new file mode 100644
index 0000000..9862440
--- /dev/null
+++ b/internal/storage/sqlite_nocgo.go
@@ -0,0 +1,21 @@
+//go:build !cgo
+
+package storage
+
+import (
+ "database/sql"
+ "database/sql/driver"
+
+ modernc "modernc.org/sqlite"
+)
+
+// Register the modernc pure-Go SQLite driver under the "sqlite3" name so that
+// the rest of the codebase can use sql.Open("sqlite3", ...) regardless of
+// whether CGO is enabled.
+func init() {
+ sql.Register("sqlite3", &modernc.Driver{})
+}
+
+// modernc.Driver satisfies driver.Driver; this blank-import ensures the
+// compiler sees the interface is satisfied.
+var _ driver.Driver = (*modernc.Driver)(nil)