Skip to main content

sqlx_gen/introspect/
mod.rs

1pub mod mysql;
2pub mod postgres;
3pub mod sqlite;
4
5#[derive(Debug, Clone)]
6#[allow(unused)]
7pub struct ColumnInfo {
8    pub name: String,
9    /// High-level data type (e.g. "integer", "character varying")
10    pub data_type: String,
11    /// Underlying type name: udt_name (PG), column_type (MySQL), declared type (SQLite)
12    pub udt_name: String,
13    pub is_nullable: bool,
14    pub ordinal_position: i32,
15    pub schema_name: String,
16}
17
18#[derive(Debug, Clone)]
19pub struct TableInfo {
20    pub schema_name: String,
21    pub name: String,
22    pub columns: Vec<ColumnInfo>,
23}
24
25#[derive(Debug, Clone)]
26pub struct EnumInfo {
27    pub schema_name: String,
28    pub name: String,
29    pub variants: Vec<String>,
30}
31
32#[derive(Debug, Clone)]
33pub struct CompositeTypeInfo {
34    pub schema_name: String,
35    pub name: String,
36    pub fields: Vec<ColumnInfo>,
37}
38
39#[derive(Debug, Clone)]
40pub struct DomainInfo {
41    pub schema_name: String,
42    pub name: String,
43    /// The underlying SQL type
44    pub base_type: String,
45}
46
47#[derive(Debug, Clone, Default)]
48pub struct SchemaInfo {
49    pub tables: Vec<TableInfo>,
50    pub views: Vec<TableInfo>,
51    pub enums: Vec<EnumInfo>,
52    pub composite_types: Vec<CompositeTypeInfo>,
53    pub domains: Vec<DomainInfo>,
54}