Implementation:2giosangmitom Sqmeow nvim params
Appearance
| Knowledge Sources | |
|---|---|
| Domains | RPC, Query_Execution, Editing, View_Processing, Result_Export |
| Last Updated | 2026-10-16 14:00 GMT |
Overview
Concrete tool for reading method arguments from MessagePack RPC calls into engine types — filters, sort keys, column indices, staged changes, and query inputs — provided by the sqmeow-core engine.
Description
The params module converts MessagePack values from Lua RPC calls into typed engine structures. It extends Args with call_id() and conn_id() accessors, and provides standalone functions for complex argument types:
- query_values — Reads a map of parameter name → input string for query parameter binding. Rejects non-string values and duplicate names; errors do not include values.
- filters — Parses an array of filter objects
{column, op, value}intoVec<Filter>. Column is optional (None = search all columns);Opis parsed from a string name. - sort — Parses an array of sort objects
{column, descending}intoVec<Sort>. - indices — Parses an array of column indices into
Option<Vec<usize>>(None for all columns). - changes — Parses a MessagePack map with "updates", "deletes", "inserts" fields into
Changesfor edit staging. Cell values are either SQL expressions (Edit::Sql) or literal values (Edit::Text/Edit::Null). - format — Parses the export format name into a
Formatenum (defaults to CSV).
Usage
- Query execution:
query_valuesreads parameter inputs;Args::call_id/conn_idread identifiers. - Local result processing:
filters,sort,indicesparse view request arguments. - In-grid editing:
changesparses staged cell edits from the grid. - Result export:
formatreads the export format;indicesreads column selection.
Code Reference
Source Location
- Repository: sqmeow.nvim
- File: core/sqmeow-core/src/server/params.rs
- Lines: L13-34 (query_values), L38-46 (call_id/conn_id), L49-55 (format), L75-81 (indices), L84-103 (filters), L106-118 (sort), L121-158 (changes)
Signature
pub(super) fn query_values(value: Option<&Value>) -> Result<HashMap<String, String>, String>;
pub(super) fn format(args: &Args) -> Result<Format, String>;
pub(super) fn indices(value: Option<&Value>) -> Option<Vec<usize>>;
pub(super) fn filters(value: Option<&Value>) -> Result<Vec<Filter>, String>;
pub(super) fn sort(value: Option<&Value>) -> Vec<Sort>;
pub(super) fn changes(value: Option<&Value>) -> Result<Changes, String>;
impl Args {
pub fn call_id(&self) -> Result<CallId, String>;
pub fn conn_id(&self, key: &str) -> Result<ConnId, String>;
}
Import
use super::params;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| value | Option<&Value> | Yes /// MessagePack value from RPC args | |
| args | &Args | Yes /// (format) Argument table |
Outputs
| Name | Type | Description |
|---|---|---|
| query_values | Result<HashMap<String, String>, String> /// Parameter name → input string | |
| filters | Result<Vec<Filter>, String> /// Filter specs (column, op, value) | |
| sort | Vec<Sort> /// Sort keys (column, descending) | |
| indices | Option<Vec<usize>> /// Column indices or None for all | |
| changes | Result<Changes, String> /// Staged edits (updates, deletes, inserts) |
Usage Examples
Parsing staged changes
// From Lua: { updates: [{row: 0, cells: [{column: 1, value: "Alice"}]}],
// deletes: [2],
// inserts: [[{column: 0, sql: "nextval('seq')"}]] }
let changes = params::changes(args.get("changes"))?;
// → Changes { updates: [(0, [(1, Text("Alice"))])],
// deletes: [2],
// inserts: [[(0, Sql("nextval('seq')"))]] }
Parsing view filters
let filters = params::filters(args.get("filters"))?;
// → [Filter { column: Some(1), op: Op::Eq, value: "Alice" }]
Related Pages
Implements Principle
- Principle:2giosangmitom_Sqmeow_nvim_In_Grid_Editing
- Principle:2giosangmitom_Sqmeow_nvim_View_Request_Parsing
Requires Environment
- (None — pure parsing)
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment