c9ac014473
- Extract shared manifest types into internal/manifest/types leaf package. - Extract SQLite adapter into internal/manifest/sqlite. - Extract JSONL adapter into internal/manifest/jsonl. - Isolate modernc.org/sqlite import to sqlite/adapter.go. - Add adapter-backed registry with manifest.Default. - Adapter-agnostic ConvertManifest in types/. - MemoryAdapter for in-memory manifest testing. - CLI uses manifest.Default registry directly. - SQLite LogWriter type assertion moved into SQLiteAdapter. - Manifest interface includes Entries(); EntryReader removed. - No behavior changes. 100% coverage across all 6 packages.
22 lines
778 B
Go
22 lines
778 B
Go
package sqlite
|
|
|
|
import (
|
|
_ "modernc.org/sqlite"
|
|
|
|
"gitea.k3s.k0.nu/tools/photocli/internal/manifest/types"
|
|
)
|
|
|
|
type Adapter struct{}
|
|
|
|
func (Adapter) Format() types.Format { return types.FormatSQLite }
|
|
func (Adapter) Aliases() []string { return []string{"db", "sqlite3"} }
|
|
func (Adapter) Path(dir string) string { return Path(dir) }
|
|
func (Adapter) Exists(dir string) bool { return FileExists(Path(dir)) }
|
|
func (Adapter) Open(dir string) (types.Manifest, error) { return Load(dir) }
|
|
func (Adapter) OpenLogWriter(m types.Manifest, dir string) (types.LogWriter, error) {
|
|
if sm, ok := m.(*Store); ok && sm.DB() != nil {
|
|
return NewLogWriter(sm.DB())
|
|
}
|
|
return types.NewFileLogWriter(types.LogPath(dir))
|
|
}
|