pub enum TypeContext {
Struct {
pipeline: String,
generator: String,
config: Value,
},
Table {
pipeline: String,
generator: String,
struct_config: Value,
table_config: Value,
},
Enum {
pipeline: String,
generator: String,
config: Value,
},
}Expand description
Context passed to output rule plugin functions.
This is a tagged union matching
evenframe_core::typesync::plugin_types::OutputRulePluginInput.
Plugins should match on the variant to dispatch: free-standing
struct, table-backed struct, or tagged-union enum. Each variant
carries the full evenframe-side config(s) as serde_json::Value so
plugin authors don’t have to pull evenframe_core into their
cdylibs. See the helper methods on TypeContext for ergonomic
accessors that cover the common lookups; anything more specialized
can navigate the JSON directly.
Variants§
Struct
A standalone (non-table) Rust struct.
Fields
Table
A Rust struct that backs a SurrealDB table.
Fields
Enum
A tagged-union Rust enum.
Implementations§
Source§impl TypeContext
impl TypeContext
Sourcepub fn pipeline(&self) -> &str
pub fn pipeline(&self) -> &str
The pipeline that will consume this result (“Both”, “Typesync”, or “Schemasync”).
Sourcepub fn generator(&self) -> &str
pub fn generator(&self) -> &str
The generator invoking this plugin, or "" for the schemasync pass.
Sourcepub fn type_name(&self) -> Option<&str>
pub fn type_name(&self) -> Option<&str>
The type’s PascalCase name: struct_name for structs/tables,
enum_name for enums.
Sourcepub fn table_name(&self) -> Option<&str>
pub fn table_name(&self) -> Option<&str>
For tables: the snake_case table name. None for non-table
structs and enums.
Sourcepub fn is_relation(&self) -> bool
pub fn is_relation(&self) -> bool
True when the table is a relation/edge. false for non-tables.
Sourcepub fn has_explicit_permissions(&self) -> bool
pub fn has_explicit_permissions(&self) -> bool
True when the table already has explicit permissions set (via
#[permissions(...)] or the per-field #[define_field_statement(...)]
aggregate). false for non-tables.
Sourcepub fn has_explicit_events(&self) -> bool
pub fn has_explicit_events(&self) -> bool
True when the table already has any events defined via
#[event(...)]. false for non-tables.
Sourcepub fn has_explicit_mock_data(&self) -> bool
pub fn has_explicit_mock_data(&self) -> bool
True when the table already has an explicit mock_generation_config.
false for non-tables.
Sourcepub fn existing_macroforge_derives(&self) -> Vec<String>
pub fn existing_macroforge_derives(&self) -> Vec<String>
Macroforge derives already declared in the Rust source via
#[macroforge_derive(...)]. Empty if none are present.
Sourcepub fn annotations(&self) -> Vec<String>
pub fn annotations(&self) -> Vec<String>
Type-level #[annotation("...")] strings as written in the
Rust source.
Sourcepub fn raw_attributes(&self) -> BTreeMap<String, Vec<String>>
pub fn raw_attributes(&self) -> BTreeMap<String, Vec<String>>
Type-level raw attribute stubs — attributes that evenframe doesn’t
parse natively, keyed by attribute name with each value being the
parenthesized body (or "" for bare path attributes like
#[overview]). Multi-occurrence attributes preserve order.
Returned as a BTreeMap so iteration is in sorted attribute-name
order, which keeps downstream annotation emission deterministic.
Sourcepub fn fields(&self) -> Vec<TypeFieldInfo>
pub fn fields(&self) -> Vec<TypeFieldInfo>
Iterate the struct’s fields (or enum’s variants). Each entry is
the raw JSON node so callers can introspect anything — use the
TypeFieldInfo accessors for the common fields.