1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
use super::table_types::{TableName, TableOffset, TablePosition, TablePrimaryKeys};
use crate::diff::types::SchemaName;

/// Represents the input for querying the count of a table.
pub struct QueryTableCountInput {
    schema_name: SchemaName,
    table_name: TableName,
}

impl QueryTableCountInput {
    /// Creates a new `QueryTableCountInput` instance.
    pub fn new(schema_name: SchemaName, table_name: TableName) -> Self {
        Self {
            schema_name,
            table_name,
        }
    }

    pub fn schema_name(&self) -> &SchemaName {
        &self.schema_name
    }

    pub fn table_name(&self) -> &TableName {
        &self.table_name
    }
}

/// Represents the input for querying table names.
pub struct QueryTableNamesInput {
    schema_name: SchemaName,
    included_tables: Vec<String>,
    excluded_tables: Vec<String>,
}

impl QueryTableNamesInput {
    /// Creates a new `QueryTableNamesInput` instance.
    pub fn new(
        schema_name: SchemaName,
        included_tables: Vec<impl Into<String>>,
        excluded_tables: Vec<impl Into<String>>,
    ) -> Self {
        Self {
            schema_name,
            included_tables: included_tables.into_iter().map(|t| t.into()).collect(),
            excluded_tables: excluded_tables.into_iter().map(|t| t.into()).collect(),
        }
    }

    pub fn schema_name(&self) -> &SchemaName {
        &self.schema_name
    }

    pub fn included_tables(&self) -> Vec<String> {
        self.included_tables.to_vec()
    }

    pub fn excluded_tables(&self) -> Vec<String> {
        self.excluded_tables.to_vec()
    }
}

/// Represents the input for querying hash data.
pub struct QueryHashDataInput {
    schema_name: SchemaName,
    table_name: TableName,
    primary_keys: TablePrimaryKeys,
    position: TablePosition,
    offset: TableOffset,
}

impl QueryHashDataInput {
    /// Creates a new `QueryHashDataInput` instance.
    pub fn new(
        schema_name: SchemaName,
        table_name: TableName,
        primary_keys: TablePrimaryKeys,
        position: TablePosition,
        offset: TableOffset,
    ) -> Self {
        Self {
            schema_name,
            table_name,
            primary_keys,
            position,
            offset,
        }
    }

    pub fn schema_name(&self) -> SchemaName {
        self.schema_name.clone()
    }

    pub fn table_name(&self) -> TableName {
        self.table_name.clone()
    }

    pub fn primary_keys(&self) -> TablePrimaryKeys {
        self.primary_keys.clone()
    }

    pub fn position(&self) -> TablePosition {
        self.position.clone()
    }

    pub fn offset(&self) -> TableOffset {
        self.offset.clone()
    }
}

/// Represents the input for querying primary keys.
pub struct QueryPrimaryKeysInput {
    table_name: String,
}

impl QueryPrimaryKeysInput {
    pub fn new(table_name: String) -> Self {
        Self { table_name }
    }

    pub fn table_name(&self) -> String {
        self.table_name.to_string()
    }
}