rust_pgdatadiff/diff/table/query/input/
mod.rs1use super::table_types::{TableName, TableOffset, TablePosition, TablePrimaryKeys};
2use crate::diff::types::SchemaName;
3
4pub struct QueryTableCountInput {
6 schema_name: SchemaName,
7 table_name: TableName,
8}
9
10impl QueryTableCountInput {
11 pub fn new(schema_name: SchemaName, table_name: TableName) -> Self {
13 Self {
14 schema_name,
15 table_name,
16 }
17 }
18
19 pub fn schema_name(&self) -> &SchemaName {
20 &self.schema_name
21 }
22
23 pub fn table_name(&self) -> &TableName {
24 &self.table_name
25 }
26}
27
28pub struct QueryTableNamesInput {
30 schema_name: SchemaName,
31 included_tables: Vec<String>,
32 excluded_tables: Vec<String>,
33}
34
35impl QueryTableNamesInput {
36 pub fn new(
38 schema_name: SchemaName,
39 included_tables: Vec<impl Into<String>>,
40 excluded_tables: Vec<impl Into<String>>,
41 ) -> Self {
42 Self {
43 schema_name,
44 included_tables: included_tables.into_iter().map(|t| t.into()).collect(),
45 excluded_tables: excluded_tables.into_iter().map(|t| t.into()).collect(),
46 }
47 }
48
49 pub fn schema_name(&self) -> &SchemaName {
50 &self.schema_name
51 }
52
53 pub fn included_tables(&self) -> Vec<String> {
54 self.included_tables.to_vec()
55 }
56
57 pub fn excluded_tables(&self) -> Vec<String> {
58 self.excluded_tables.to_vec()
59 }
60}
61
62pub struct QueryHashDataInput {
64 schema_name: SchemaName,
65 table_name: TableName,
66 primary_keys: TablePrimaryKeys,
67 position: TablePosition,
68 offset: TableOffset,
69}
70
71impl QueryHashDataInput {
72 pub fn new(
74 schema_name: SchemaName,
75 table_name: TableName,
76 primary_keys: TablePrimaryKeys,
77 position: TablePosition,
78 offset: TableOffset,
79 ) -> Self {
80 Self {
81 schema_name,
82 table_name,
83 primary_keys,
84 position,
85 offset,
86 }
87 }
88
89 pub fn schema_name(&self) -> SchemaName {
90 self.schema_name.clone()
91 }
92
93 pub fn table_name(&self) -> TableName {
94 self.table_name.clone()
95 }
96
97 pub fn primary_keys(&self) -> TablePrimaryKeys {
98 self.primary_keys.clone()
99 }
100
101 pub fn position(&self) -> TablePosition {
102 self.position.clone()
103 }
104
105 pub fn offset(&self) -> TableOffset {
106 self.offset.clone()
107 }
108}
109
110pub struct QueryPrimaryKeysInput {
112 table_name: String,
113}
114
115impl QueryPrimaryKeysInput {
116 pub fn new(table_name: String) -> Self {
117 Self { table_name }
118 }
119
120 pub fn table_name(&self) -> String {
121 self.table_name.to_string()
122 }
123}