pg_extras/queries/
mandelbrot.rs1use crate::{queries::shared::Query, PgStatsVersion};
2use sqlx::{postgres::PgRow, Row};
3
4#[derive(Debug, Clone, serde::Serialize)]
5pub struct Mandelbrot {
6 pub array_to_string: String,
7}
8
9impl Query for Mandelbrot {
10 fn new(row: &PgRow) -> Self {
11 Self {
12 array_to_string: row.try_get("array_to_string").unwrap_or_default(),
13 }
14 }
15
16 fn to_row(&self) -> prettytable::Row {
17 row![self.array_to_string]
18 }
19
20 fn headers() -> prettytable::Row {
21 row!["array_to_string"]
22 }
23
24 fn read_file(_pg_statement_version: Option<PgStatsVersion>) -> String {
25 include_str!("../sql/mandelbrot.sql").to_string()
26 }
27}