Skip to main content

Type

Enum Type 

Source
pub enum Type {
    Unspecified,
    Number,
    String,
    Bool,
    Array(TypeRef),
    Record(Record),
    Subject,
    App {
        args: FunArgs,
        result: TypeRef,
        aggregate: bool,
    },
    Date,
    Time,
    DateTime,
    Custom(StrRef),
}
Expand description

Type information for expressions.

This enum represents the type of expressions in the EventQL type system. Types can be inferred during semantic analysis or left as Unspecified.

Variants§

§

Unspecified

Type has not been determined yet

§

Number

Numeric type (f64)

§

String

String type

§

Bool

Boolean type

§

Array(TypeRef)

Array type

§

Record(Record)

Record (object) type

§

Subject

Subject pattern type

§

App

Function type with support for optional parameters.

The args field uses FunArgs to support both required and optional parameters. Optional parameters are indicated when args.needed < args.values.len().

Fields

§args: FunArgs

Function argument types, supporting optional parameters

§result: TypeRef

Return type of the function

§aggregate: bool

Whether this is an aggregate function (operates on grouped data)

§

Date

Date type (e.g., 2026-01-03)

Used when a field is explicitly converted to a date using the AS DATE syntax.

§

Time

Time type (e.g., 13:45:39)

Used when a field is explicitly converted to a time using the AS TIME syntax.

§

DateTime

DateTime type (e.g., 2026-01-01T13:45:39Z)

Used when a field is explicitly converted to a datetime using the AS DATETIME syntax.

§

Custom(StrRef)

Custom type not defined in the EventQL reference

Used when a field is converted to a custom type registered in the analysis options. The string contains the custom type name as it appears in the query.

§Examples

use eventql_parser::Session;

let mut session = Session::builder()
    .declare_custom_type("CustomTimestamp")
    .build();
let query = session.parse("FROM e IN events PROJECT INTO { ts: e.data.timestamp as CustomTimestamp }").unwrap();
let typed_query = session.run_static_analysis(query).unwrap();

Implementations§

Source§

impl Type

Source

pub fn as_record_or_panic(&self) -> Record

Returns the inner Record reference, panicking if this is not a Type::Record.

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Type

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Type

Source§

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

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

impl Default for Type

Source§

fn default() -> Type

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

impl Hash for Type

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Type) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Type

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Type

Source§

impl Eq for Type

Source§

impl StructuralPartialEq for Type

Auto Trait Implementations§

§

impl Freeze for Type

§

impl RefUnwindSafe for Type

§

impl Send for Type

§

impl Sync for Type

§

impl Unpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

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<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 = Infallible

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.