1use std::collections::HashMap;
2use std::sync::Arc;
3use crate::metadata::MetaData;
4
5#[derive(Clone)]
6pub enum TableFilter {
7 Names(Vec<String>),
8 Predicate(Arc<dyn Fn(&str, &MetaData) -> bool + Send + Sync>),
9}
10
11impl std::fmt::Debug for TableFilter {
12 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13 match self {
14 Self::Names(names) => write!(f, "Names({:?})", names),
15 Self::Predicate(_) => write!(f, "Predicate(<fn>)"),
16 }
17 }
18}
19
20#[derive(Debug, Clone)]
21pub struct ReflectOptions {
22 pub schema: Option<String>,
23 pub include_views: bool,
24 pub only: Option<TableFilter>,
25 pub extend_existing: bool,
26 pub autoload_replace: bool,
27 pub resolve_fks: bool,
28 pub dialect_options: HashMap<String, String>,
29}
30
31impl Default for ReflectOptions {
32 fn default() -> Self {
33 Self {
34 schema: None,
35 include_views: false,
36 only: None,
37 extend_existing: false,
38 autoload_replace: true,
39 resolve_fks: true,
40 dialect_options: HashMap::new(),
41 }
42 }
43}