Skip to content

chore(executor): extract pg_on.rs (#116 step 9)#520

Merged
ujeenet merged 1 commit into
developfrom
chore/116-executor-reorg-step9-extract-pg-on
May 23, 2026
Merged

chore(executor): extract pg_on.rs (#116 step 9)#520
ujeenet merged 1 commit into
developfrom
chore/116-executor-reorg-step9-extract-pg-on

Conversation

@ujeenet
Copy link
Copy Markdown
Owner

@ujeenet ujeenet commented May 23, 2026

Summary

Step 9 of the executor reorg (#116). Pulls the PG-typed `_on` CRUD family into `executor/pg_on.rs` (181 LOC):

  • `insert_on` / `update_on` / `delete_on`
  • `select_rows_on` / `select_one_row_on`
  • `insert_returning_on` / `bulk_insert_on`

These accept any sqlx executor (`&PgPool` / `&mut PgConnection` / `Transaction`). Tenant-scoped writes need them — schema-mode tenants share the registry pool and rely on per-checkout `SET search_path`; passing a fresh `&PgPool` would silently hit the wrong schema.

Mounted under `#[cfg(feature = "postgres")]` in mod.rs so the per-function `postgres` cfg gates were dropped inside the file.

mod.rs: 2803 → 2637 LOC (-166). pg_on.rs: 181 LOC.

`raw_query_on` + `fetch_aggregate_on` still live in mod.rs (they're at lines 1038+ in a different section) — separate step.

Part of

#116 (step 9)

Test plan

  • `cargo check --no-default-features --features sqlite,tenancy` clean.
  • `cargo check --all-features` clean.
  • `cargo test --lib --no-default-features --features sqlite,tenancy` — 1482 passing.
  • No public API change.

Pulls the PG-typed _on CRUD family out of mod.rs into a dedicated
file (181 LOC):

- insert_on / update_on / delete_on
- select_rows_on / select_one_row_on
- insert_returning_on
- bulk_insert_on

These accept any sqlx executor (&PgPool / &mut PgConnection /
Transaction). Tenant-scoped writes need them — schema-mode tenants
share the registry pool and rely on per-checkout SET search_path;
passing a fresh &PgPool would silently hit the wrong schema.

Mounted under #[cfg(feature = postgres)] in mod.rs, so per-function
postgres cfg gates were dropped inside the file. raw_query_on +
fetch_aggregate_on still live in mod.rs — they're at lines 1038+
in a different section and will move in a later step.

mod.rs: 2803 → 2637 LOC (-166). pg_on.rs: 181 LOC.

No public-API change. 1482 lib tests pass on sqlite,tenancy litmus.

Part of #116 (step 9).
@ujeenet ujeenet merged commit fa9348c into develop May 23, 2026
8 checks passed
@ujeenet ujeenet deleted the chore/116-executor-reorg-step9-extract-pg-on branch May 23, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant