Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:2giosangmitom Sqmeow nvim Core introspect

From Leeroopedia
Knowledge Sources
Domains Schema, Connection_Management
Last Updated 2026-10-16 14:00 GMT

Overview

Concrete tool for reading the schema tree that the Neovim drawer displays, provided by the sqmeow-core engine.

Description

The Core::introspect method reads one level of the schema tree for a connection, emitting a schema:nodes event with the results. The path is at most 3 levels deep ([schema, group, relation]). An empty path returns top-level nodes (schemas or cluster databases, plus Roles where available). A schema path returns groups (Tables, Views, Functions, Procedures, etc.). A group path returns members (relations or routines). A relation path returns columns. Redis databases support a pattern glob for key listing.

Core::structure is a companion method that reads a single table's columns, indexes, and details (foreign keys, comments, constraints, definition), emitting a structure:done event.

Both methods use the Backend's metadata methods (schemas, relations, columns, indexes, routines, roles, details) to fetch catalog data from the live adapter.

Usage

Use this method when the schema drawer in Neovim expands a connection, schema, group, or relation node to show its children.

Code Reference

Source Location

  • Repository: sqmeow.nvim
  • File: core/sqmeow-core/src/server/schema.rs
  • Lines: L27-116 (introspect), L45-79 (structure)

Signature

impl Core {
    pub(super) fn introspect(self: Arc<Self>, args: &Args) -> Started;
    pub(super) fn structure(self: Arc<Self>, args: &Args) -> Started;
    async fn read_level(self: Arc<Self>, connection: Arc<Connection>, path: Vec<String>, pattern: Option<String>);
}

Import

// Internal to Core; dispatched from on_request handler.

I/O Contract

Inputs

Name Type Required Description
conn_id ConnId Yes Connection to introspect
path Vec<String> No /// Schema path (max 3 levels: schema, group, relation)
pattern Option<String> No /// Redis key glob
relation String Yes /// (structure) Table/view name
schema String No /// (structure) Schema name (empty for default)

Outputs

Name Type Description
reply Value::Boolean(true) /// Acknowledgement sent before async work
schema:nodes Event /// Emitted with conn_id, path, nodes array, optional error
structure:done Event /// Emitted with columns, indexes, details, optional error

Usage Examples

Listing a connection's schemas

// RPC: introspect { conn_id: 1, path: [] }
// Emits schema:nodes with:
//   { conn_id: 1, path: [], nodes: [
//     { name: "public", kind: "schema", expandable: true, is_default: true },
//     { name: "@roles", kind: "roles", ... }
//   ]}

Listing a table's columns

// RPC: structure { conn_id: 1, schema: "public", relation: "users" }
// Emits structure:done with:
//   { conn_id, schema, relation, columns: [...], indexes: [...], ... }

Related Pages

Implements Principle

Requires Environment

  • (Requires open database connection)

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment