v0.10.0: ports and adapters refactor
- 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.
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package manifest
|
||||
|
||||
import (
|
||||
jsonladapter "gitea.k3s.k0.nu/tools/photocli/internal/manifest/jsonl"
|
||||
"gitea.k3s.k0.nu/tools/photocli/internal/manifest/sqlite"
|
||||
"gitea.k3s.k0.nu/tools/photocli/internal/manifest/types"
|
||||
)
|
||||
|
||||
var (
|
||||
JSONLAdapter = jsonladapter.Adapter{}
|
||||
SQLiteAdapter = sqlite.Adapter{}
|
||||
)
|
||||
|
||||
var Default = types.NewRegistry(JSONLAdapter, SQLiteAdapter)
|
||||
|
||||
func LoadJSONL(dir string) *jsonladapter.Store {
|
||||
return jsonladapter.Load(dir)
|
||||
}
|
||||
|
||||
func JSONLPath(dir string) string {
|
||||
return jsonladapter.Path(dir)
|
||||
}
|
||||
|
||||
func SetJSONLSaveHook(fn func() error) func() error {
|
||||
return jsonladapter.SetSaveHook(fn)
|
||||
}
|
||||
|
||||
func LoadSQLite(dir string) (Manifest, error) {
|
||||
return sqlite.Load(dir)
|
||||
}
|
||||
|
||||
func SQLitePath(dir string) string {
|
||||
return sqlite.Path(dir)
|
||||
}
|
||||
Reference in New Issue
Block a user