pub struct ParseResult {
pub tables: HashMap<String, ParsedTable>,
pub indexes: HashMap<String, ParsedIndex>,
pub schema: Option<ParsedSchema>,
pub dialect: Dialect,
pub enums: HashMap<String, ParsedEnum>,
pub views: HashMap<String, ParsedView>,
pub policies: HashMap<String, ParsedPolicy>,
pub warnings: Vec<String>,
pub errors: Vec<String>,
}std only.Expand description
Result of parsing schema code
Fields§
§tables: HashMap<String, ParsedTable>Parsed table structs, keyed "<dialect>:<StructName>"
indexes: HashMap<String, ParsedIndex>Parsed index structs, keyed "<dialect>:<StructName>"
schema: Option<ParsedSchema>Parsed schema struct (if present)
dialect: DialectDetected dialect (based on first found table/schema)
enums: HashMap<String, ParsedEnum>Parsed enums, keyed "<dialect>:<EnumName>"
views: HashMap<String, ParsedView>Parsed views, keyed "<dialect>:<StructName>"
policies: HashMap<String, ParsedPolicy>Parsed policies, keyed "<dialect>:<StructName>"
warnings: Vec<String>Non-fatal notes: constructs the parser recognized but cannot fully represent (opaque view definitions, cfg-divergent duplicates, custom column types, unsupported default expressions, …).
errors: Vec<String>Hard failures: source that failed to parse or attributes the macros would reject. Entities are still emitted best-effort, but callers should surface these to the user.
Implementations§
Source§impl ParseResult
impl ParseResult
Sourcepub fn table(&self, name: &str, dialect: Dialect) -> Option<&ParsedTable>
pub fn table(&self, name: &str, dialect: Dialect) -> Option<&ParsedTable>
Get a table by name and dialect
Sourcepub fn index(&self, name: &str, dialect: Dialect) -> Option<&ParsedIndex>
pub fn index(&self, name: &str, dialect: Dialect) -> Option<&ParsedIndex>
Get an index by name and dialect
Sourcepub fn parsed_enum(&self, name: &str, dialect: Dialect) -> Option<&ParsedEnum>
pub fn parsed_enum(&self, name: &str, dialect: Dialect) -> Option<&ParsedEnum>
Get an enum by name and dialect
Sourcepub fn view(&self, name: &str, dialect: Dialect) -> Option<&ParsedView>
pub fn view(&self, name: &str, dialect: Dialect) -> Option<&ParsedView>
Get a view by name and dialect
Sourcepub fn policy(&self, name: &str, dialect: Dialect) -> Option<&ParsedPolicy>
pub fn policy(&self, name: &str, dialect: Dialect) -> Option<&ParsedPolicy>
Get a policy by name and dialect
Sourcepub fn tables_for_dialect(
&self,
dialect: Dialect,
) -> impl Iterator<Item = &ParsedTable>
pub fn tables_for_dialect( &self, dialect: Dialect, ) -> impl Iterator<Item = &ParsedTable>
Get all tables for a specific dialect
Sourcepub fn indexes_for_dialect(
&self,
dialect: Dialect,
) -> impl Iterator<Item = &ParsedIndex>
pub fn indexes_for_dialect( &self, dialect: Dialect, ) -> impl Iterator<Item = &ParsedIndex>
Get all indexes for a specific dialect
Sourcepub fn table_names(&self) -> Vec<&str>
pub fn table_names(&self) -> Vec<&str>
Get all table names (without dialect prefix)
Sourcepub fn index_names(&self) -> Vec<&str>
pub fn index_names(&self) -> Vec<&str>
Get all index names (without dialect prefix)
Trait Implementations§
Source§impl Clone for ParseResult
impl Clone for ParseResult
Source§fn clone(&self) -> ParseResult
fn clone(&self) -> ParseResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more