sqlx_paginated/paginated_query_as/builders/query_builders/
postgres_query_builder.rs

1use crate::paginated_query_as::internal::{
2    get_struct_field_names, ColumnProtection, PostgresDialect,
3};
4use crate::QueryBuilder;
5use serde::Serialize;
6use std::marker::PhantomData;
7
8impl<T> Default for QueryBuilder<'_, T, sqlx::Postgres>
9where
10    T: Default + Serialize,
11{
12    fn default() -> Self {
13        Self::new()
14    }
15}
16
17impl<T> QueryBuilder<'_, T, sqlx::Postgres>
18where
19    T: Default + Serialize,
20{
21    pub fn new() -> Self {
22        Self {
23            conditions: Vec::new(),
24            arguments: sqlx::postgres::PgArguments::default(),
25            valid_columns: get_struct_field_names::<T>(),
26            protection: Some(ColumnProtection::default()),
27            protection_enabled: true,
28            dialect: Box::new(PostgresDialect),
29            _phantom: PhantomData,
30        }
31    }
32}