Add user model and SQLite storage
internal/storage/ provides: - Open(path) to create or open the SQLite database with WAL journal, busy timeout, and foreign keys enabled - Embedded migrations that create the users table on first run - UserStore with Create, GetByID, GetByEmail, UpdateLastLogin, Delete - Email normalisation (trim+lowercase) and uniqueness enforcement with ErrEmailTaken - ErrNotFound on lookups and deletes - UUIDv4 IDs auto-generated when caller leaves ID empty Uses modernc.org/sqlite (pure-Go) so the binary stays CGO-free and matches Dockerfile.dev's CGO_ENABLED=0. Tests cover all CRUD operations, email uniqueness (case-insensitive), WAL mode verification, and ErrNotFound paths. Closes #8. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,29 @@
|
||||
module git.librete.ch/public/librenotes
|
||||
|
||||
go 1.20
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/junegunn/fzf v0.58.0
|
||||
modernc.org/sqlite v1.50.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/charlievieth/fastwalk v1.0.9 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/gdamore/encoding v1.0.1 // indirect
|
||||
github.com/gdamore/tcell/v2 v2.8.1 // indirect
|
||||
github.com/junegunn/fzf v0.58.0 // indirect
|
||||
github.com/junegunn/go-shellwords v0.0.0-20240813092932-a62c48c52e97 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/sys v0.42.0 // indirect
|
||||
golang.org/x/term v0.28.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
modernc.org/libc v1.72.0 // indirect
|
||||
modernc.org/mathutil v1.7.1 // indirect
|
||||
modernc.org/memory v1.11.0 // indirect
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user