MCPcopy Index your code
hub / github.com/douglance/devsql / write_json

Method write_json

crates/ccql/src/cli/output.rs:25–41  ·  view source on GitHub ↗
(&mut self, data: &T)

Source from the content-addressed store, hash-verified

23 }
24
25 pub fn write_json<T: Serialize>(&mut self, data: &T) -> Result<()> {
26 match self.format {
27 OutputFormat::Json => {
28 let json = serde_json::to_string_pretty(data)?;
29 writeln!(self.writer, "{}", json)?;
30 }
31 OutputFormat::Raw | OutputFormat::Jsonl => {
32 let json = serde_json::to_string(data)?;
33 writeln!(self.writer, "{}", json)?;
34 }
35 OutputFormat::Table => {
36 let json = serde_json::to_string_pretty(data)?;
37 writeln!(self.writer, "{}", json)?;
38 }
39 }
40 Ok(())
41 }
42
43 pub fn write_table(&mut self, table: Table) -> Result<()> {
44 writeln!(self.writer, "{}", table)?;

Callers 8

promptsFunction · 0.80
queryFunction · 0.80
sessionsFunction · 0.80
statsFunction · 0.80
searchFunction · 0.80
todosFunction · 0.80
duplicatesFunction · 0.80
sqlFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected