You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`DbCodec`, `.biMap(to, from)`| same | ✓ identical |
27
-
|`DbCodec.StringCodec`|`DbCodec[String]` (i.e. `summon[DbCodec[String]]`) |`StringCodec` given exists; prefer `DbCodec[String]`|
27
+
|`DbCodec.StringCodec`|`DbCodec.StringCodec` (also `DbCodec[String]`) |✓ `StringCodec`is a given in `object DbCodec`; `DbCodec.StringCodec.biMap(...)` compiles as-is|
28
28
|`summon[DbCodec[OffsetDateTime]]`| same | ✓ `OffsetDateTimeCodec` given exists |
29
-
| custom `given DbCodec[Instant]` (in `infrastructure/Magnum.scala`) |**remove**| parlance already ships `given DbCodec[Instant]`; keeping the custom one is an ambiguous-given conflict|
30
-
|`Transactor(dataSource = ds, sqlLogger = ...)`|`Transactor(Postgres, ds, SqlLogger.logSlowQueries(200.millis))`|**DB type is now a required first arg**; `Transactor[D <: DatabaseType]`|
29
+
| custom `given DbCodec[Instant]` (in `infrastructure/Codecs.scala`) |**keep**| parlance ships `given InstantCodec: DbCodec[Instant]` in `object DbCodec`, but an *imported*given (via `import Codecs.given`) takes precedence over implicit/companion scope — **verified: no ambiguity**. (Corrects the earlier note that said to remove it.)|
30
+
|`Transactor(dataSource = ds, sqlLogger = ...)`|`Transactor[Postgres](Postgres, ds, SqlLogger.logSlowQueries(200.millis))`|**DB type is a required first arg** AND must be **pinned** as `[Postgres]` — `Transactor(Postgres, ...)` infers the singleton `Postgres.type`, which then mismatches `DbTx[Postgres]` everywhere.|
31
31
|`SqlLogger.logSlowQueries(200.millis)`| same | ✓ |
| top-level `connect(ds)(f)`|**`transactor.connect(f)`** (instance method) |`connect` takes no DataSource — needs a `Transactor`; `def connect[T](f: DbCon[D] ?=> T): T`. DB.scala `testConnection(ds)`must build/reuse a Transactor instead of passing a raw `DataSource`. |
32
+
| top-level `transact(transactor)(f)`|**`transactor.transact(f)`** (instance method) |`def transact[T](f: DbTx[D] ?=> T): T`. Rolls back only on a thrown exception (then rethrows) — so the `LeftException` rollback-on-`Left` trick still works unchanged.|
33
+
| top-level `connect(ds)(f)`|**`transactor.connect(f)`** (instance method) |`connect` takes no DataSource — needs a `Transactor`; `def connect[T](f: DbCon[D] ?=> T): T`. DB.scala `testConnection(ds)`builds a throwaway `Transactor[Postgres](Postgres, ds)` to run the test query. |
34
34
|`(using DbTx)`, `DbTx ?=> T`|**`(using DbTx[Postgres])`, `DbTx[Postgres] ?=> T`**|`DbCon`/`DbTx` are parameterized by DB type. Touches *every* model/service/api file with a `DbTx` param (UserModel, UserService, ApiKeyModel, ApiKeyService, Auth, PasswordResetCodeModel, PasswordResetService, EmailModel, EmailService, the `*Api` files, `AuthTokenOps`). Read-only sites may use `DbCon[Postgres]`. |
35
35
|`sql"..."` interpolator | same | ✓ available via wildcard import; if selectively imported, confirm the `sql` name is importable |
36
36
|`.query[T].run()`, `.update.run()`| same | ✓ require a `DbCon`/`DbTx` in scope |
@@ -52,6 +52,6 @@ parlance 0.1.0 is a redesigned, Active-Record-inspired ORM (92 core source files
52
52
2.`TableInfo` column-reference + `sql"$u"` table interpolation: confirm the API matches Magnum's usage in `UserModel`/`ApiKeyModel`.
53
53
3. Add `derives EntityMeta` to all entities; drop the DB-type arg from every `@Table`.
54
54
4. Parameterize all `DbTx`/`DbCon` usages with `[Postgres]`.
55
-
5. Rework `DB.scala`: `Transactor(Postgres, ds, ...)`, instance `transact`/`connect`, and `testConnection` (no raw-DataSource `connect`).
56
-
6. Remove the custom `given DbCodec[Instant]`; switch `DbCodec.StringCodec`→ `DbCodec[String]`.
55
+
5.~~Rework `DB.scala`~~**DONE** (and `infrastructure/Magnum.scala` → `infrastructure/Codecs.scala`, with the four import sites updated).
56
+
6.~~Remove the custom `given DbCodec[Instant]`~~ — keep it; `DbCodec.StringCodec`works as-is (see table).
57
57
7.`insert` → `rawInsert`; add `()` to `Repo[...]` constructions.
0 commit comments