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 is_primary_key: bool,
15    pub ordinal_position: i32,
16    pub schema_name: String,
17}
18
19#[derive(Debug, Clone)]
20pub struct TableInfo {
21    pub schema_name: String,
22    pub name: String,
23    pub columns: Vec<ColumnInfo>,
24}
25
26#[derive(Debug, Clone)]
27pub struct EnumInfo {
28    pub schema_name: String,
29    pub name: String,
30    pub variants: Vec<String>,
31}
32
33#[derive(Debug, Clone)]
34pub struct CompositeTypeInfo {
35    pub schema_name: String,
36    pub name: String,
37    pub fields: Vec<ColumnInfo>,
38}
39
40#[derive(Debug, Clone)]
41pub struct DomainInfo {
42    pub schema_name: String,
43    pub name: String,
44    /// The underlying SQL type
45    pub base_type: String,
46}
47
48#[derive(Debug, Clone, Default)]
49pub struct SchemaInfo {
50    pub tables: Vec<TableInfo>,
51    pub views: Vec<TableInfo>,
52    pub enums: Vec<EnumInfo>,
53    pub composite_types: Vec<CompositeTypeInfo>,
54    pub domains: Vec<DomainInfo>,
55}