Skip to content

feat(schema): show functions and procedures in the object tree#36

Merged
exzvor merged 2 commits into
mainfrom
feat/33-functions-tree
Jun 2, 2026
Merged

feat(schema): show functions and procedures in the object tree#36
exzvor merged 2 commits into
mainfrom
feat/33-functions-tree

Conversation

@exzvor

@exzvor exzvor commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to materialized views (#27) and a support request: functions and procedures defined in a schema weren't shown in the object tree, though the backend already lists them. Adds Functions and Procedures groups under each schema (mirroring Tables / Views / Materialized views), with a definition view on selection.

Routines are overloadable (same name, different arg signatures) and the definition fetch needs the exact args, so routine leaf keys encode the signature: function:<schema>/<name>#<encodedArgs>. A shared routineKey / parseRoutineKey codec keeps the store (key builder) and ObjectDetails (decoder) in lockstep; percent-encoding the args keeps them clear of the / and # delimiters. Two groups rather than one merged "Routines" group, because the backend exposes two distinct list/definition commands with asymmetric DTOs.

Related issue

Fixes #33

Tests

  • store.test.ts: a schema now expands to five synthetic groups (tables/views/matviews/functions/procedures) with no backend call; /functions and /procedures map to leaf nodes (asserting schemaListFunctions(conn,'public',false) / schemaListProcedures); overloads produce distinct keys; routineKeyparseRoutineKey round-trips args with commas/spaces/brackets and empty args. Existing SchemaTree/ObjectDetails/Browser suites stay green (85 total).
  • Manual smoke — connect → Functions/Procedures groups list routines; selecting one shows its definition.

Self-verification

  • npm run typecheck / npm run lint clean
  • npm run test green (schema feature: 85)
  • No Rust changed — schema_list_functions / schema_list_procedures / definitions already existed
  • DCO sign-off

Notes for reviewer

RoutineDetails is one component for both function and procedure (renders signature + language + body; the union's common fields only, no per-kind narrowing). Routines are selectable leaves (no expand caret); not added to the actionable context menu (no routine editor yet) — that can be a follow-up.

exzvor added 2 commits June 2, 2026 21:42
Follow-up to the materialized-views work (#27) and a support request: routines
defined in a schema were not shown in the tree, though the backend already
lists them. Add Functions and Procedures groups under each schema, mirroring
the Tables/Views/Materialized-views pattern, with a definition view on select.

Functions/procedures are overloadable (same name, different arg signatures) and
the definition fetch needs the exact args, so routine leaf node keys encode the
signature: function:<schema>/<name>#<encodedArgs>. A shared routineKey/
parseRoutineKey codec keeps the store (key builder) and ObjectDetails (decoder)
in lockstep, and percent-encoding the args keeps them clear of the key
delimiters. Two groups (not one merged Routines group) because the backend
exposes two distinct list/definition commands with asymmetric DTOs.

Fixes #33

Signed-off-by: exzvor <exzvor@gmail.com>
@exzvor exzvor merged commit e68f2d0 into main Jun 2, 2026
2 checks passed
@exzvor exzvor deleted the feat/33-functions-tree branch June 2, 2026 18:54
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.

[feature] Show functions & procedures in the schema tree

1 participant