refactor: extract adapter-common crate — shared sqlx error mapping,
row-to-domain conversions, date/uuid utils Eliminates 39 map_err copies, consolidates parse_uuid/parse_datetime/ datetime_to_str/format_year_month, extracts 7 shared row-to-domain conversion functions (movie, review, watchlist, stats, user_summary). Row structs stay per-adapter (FromRow is db-specific), only conversion logic is shared. Net -281 lines.
This commit is contained in:
17
Cargo.lock
generated
17
Cargo.lock
generated
@@ -220,6 +220,17 @@ dependencies = [
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adapter-common"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"domain",
|
||||
"sqlx",
|
||||
"tracing",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler2"
|
||||
version = "2.0.1"
|
||||
@@ -3884,6 +3895,7 @@ dependencies = [
|
||||
name = "postgres"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"adapter-common",
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
"async-trait",
|
||||
@@ -3920,6 +3932,7 @@ name = "postgres-federation"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"activitypub",
|
||||
"adapter-common",
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"chrono",
|
||||
@@ -3935,6 +3948,7 @@ dependencies = [
|
||||
name = "postgres-search"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"adapter-common",
|
||||
"async-trait",
|
||||
"domain",
|
||||
"sqlx",
|
||||
@@ -5164,6 +5178,7 @@ dependencies = [
|
||||
name = "sqlite"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"adapter-common",
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
"async-trait",
|
||||
@@ -5200,6 +5215,7 @@ name = "sqlite-federation"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"activitypub",
|
||||
"adapter-common",
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
"chrono",
|
||||
@@ -5216,6 +5232,7 @@ dependencies = [
|
||||
name = "sqlite-search"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"adapter-common",
|
||||
"async-trait",
|
||||
"domain",
|
||||
"sqlx",
|
||||
|
||||
Reference in New Issue
Block a user