Skip to main content

pg_extras/queries/
ssl_used.rs

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