Skip to main content

ParseResult

Struct ParseResult 

Source
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>,
}
Available on crate feature 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: Dialect

Detected 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

Source

pub fn table(&self, name: &str, dialect: Dialect) -> Option<&ParsedTable>

Get a table by name and dialect

Source

pub fn index(&self, name: &str, dialect: Dialect) -> Option<&ParsedIndex>

Get an index by name and dialect

Source

pub fn parsed_enum(&self, name: &str, dialect: Dialect) -> Option<&ParsedEnum>

Get an enum by name and dialect

Source

pub fn view(&self, name: &str, dialect: Dialect) -> Option<&ParsedView>

Get a view by name and dialect

Source

pub fn policy(&self, name: &str, dialect: Dialect) -> Option<&ParsedPolicy>

Get a policy by name and dialect

Source

pub fn tables_for_dialect( &self, dialect: Dialect, ) -> impl Iterator<Item = &ParsedTable>

Get all tables for a specific dialect

Source

pub fn indexes_for_dialect( &self, dialect: Dialect, ) -> impl Iterator<Item = &ParsedIndex>

Get all indexes for a specific dialect

Source

pub fn table_names(&self) -> Vec<&str>

Get all table names (without dialect prefix)

Source

pub fn index_names(&self) -> Vec<&str>

Get all index names (without dialect prefix)

Trait Implementations§

Source§

impl Clone for ParseResult

Source§

fn clone(&self) -> ParseResult

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParseResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for ParseResult

Source§

fn default() -> ParseResult

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AliasExt for T

Source§

fn alias(self, name: &'static str) -> AliasedExpr<Self>

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Mk> MarkerAggValidFor<()> for Mk

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Scope> ScopeSatisfies<Nil, ()> for Scope

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TypeEq<T> for T