pub struct EventTypeRecordBuilder<'a> { /* private fields */ }Expand description
Builder for defining the fields of a record-shaped event type.
Obtained by calling EventTypeBuilder::define_record. Add fields with prop
and finalize with as_default_event_type or
for_data_source to return to the EventTypeBuilder.
Implementations§
Source§impl<'a> EventTypeRecordBuilder<'a>
impl<'a> EventTypeRecordBuilder<'a>
Sourcepub fn prop_when(self, test: bool, name: &str, tpe: Type) -> Self
pub fn prop_when(self, test: bool, name: &str, tpe: Type) -> Self
Conditionally adds a field to the event record type.
Sourcepub fn prop(self, name: &str, tpe: Type) -> Self
pub fn prop(self, name: &str, tpe: Type) -> Self
Adds a field with the given name and type to the event record type.
Sourcepub fn as_default_event_type(self) -> EventTypeBuilder<'a>
pub fn as_default_event_type(self) -> EventTypeBuilder<'a>
Finalizes the event record type and returns the SessionBuilder.
Sourcepub fn for_data_source(self, data_source: &str) -> EventTypeBuilder<'a>
pub fn for_data_source(self, data_source: &str) -> EventTypeBuilder<'a>
Finalizes the record type and registers it for a specific named data source.
Queries targeting data_source will use this record type for type checking.
Data source names are case-insensitive. Returns the EventTypeBuilder to allow
chaining further type declarations.
Sourcepub fn build(self) -> (Type, TypeRef)
pub fn build(self) -> (Type, TypeRef)
Creates a record type and returns it with its registered type reference.
Use the returned Type where an API expects the record type directly. Use the
returned TypeRef when building another type that needs to point at this record,
such as Type::Array.
The TypeRef belongs to the current SessionBuilder’s arena and should only
be used with types configured through the same builder.