-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintrospection.rs
66 lines (57 loc) · 1.64 KB
/
introspection.rs
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
//! Configuration and state for our connector.
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct IntrospectStoredProcedureArgument {
pub name: String,
pub r#type: String,
pub is_nullable: bool,
pub max_length: u8,
pub is_output: bool,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectStoredProcedure {
pub schema: String,
pub name: String,
#[serde(default)]
pub arguments: Vec<IntrospectStoredProcedureArgument>,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionTable {
pub name: String,
pub type_desc: String,
pub joined_sys_schema: IntrospectionSchema,
pub joined_sys_column: Vec<IntrospectionColumn>,
pub joined_sys_primary_key: Option<IntrospectionPrimaryKey>,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionColumn {
pub name: String,
pub is_nullable: bool,
pub is_identity: bool,
pub is_computed: bool,
pub joined_sys_type: IntrospectionType,
pub joined_foreign_key_columns: Vec<IntrospectionForeignKeyColumn>,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionType {
pub name: String,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionPrimaryKey {
pub name: String,
pub columns: Vec<IntrospectionPrimaryKeyColumn>,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionPrimaryKeyColumn {
pub name: String,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionForeignKeyColumn {
pub joined_referenced_table_name: String,
pub joined_referenced_column_name: String,
pub joined_referenced_sys_schema: IntrospectionSchema,
}
#[derive(Deserialize, Debug)]
pub struct IntrospectionSchema {
pub name: String,
}