Skip to main content

LogicalType

Enum LogicalType 

Source
pub enum LogicalType {
Show 25 variants Null, Nothing, Bool, Int { signed: bool, bits: IntBits, precision: Option<u16>, }, Decimal { precision: u16, scale: u16, }, Float { bits: FloatBits, precision: Option<u16>, }, Str { min: Option<u32>, max: Option<u32>, fixed: bool, }, Bytes { min: Option<u32>, max: Option<u32>, fixed: bool, }, Date, LocalTime, LocalDatetime, ZonedTime, ZonedDatetime, Duration(DurationKind), Node(Option<String>), Edge(Option<String>), Graph(Option<String>), BindingTable(Option<RecordType>), Path(Option<Box<PathType>>), List { elem: Box<LogicalType>, max: Option<u32>, }, Record(RecordType), Any, Union(Vec<LogicalType>), AnyProperty, Nullable(Box<LogicalType>),
}
Expand description

What GQL talks about: the language facing type lattice.

Never present in a vector. A vector holds a PhysicalType and a validity bitmap, and the logical type is what the binder knows about the column, which is a different and larger thing: INT(4) NOT NULL and BIGINT are two logical types over one physical layout.

Variants§

§

Null

GV71. The type of the null literal, which every nullable type accepts and which carries no other value.

§

Nothing

GV72. The empty type: no value has it. A column can never be declared with it, an expression can have it, and the binder refuses anything that would have to materialise one.

§

Bool

§

Int

GV01 to GV19. signed and the width are the tower; precision is the declared decimal digit count of INT(p), kept because it is a check the engine owes the user and not a layout.

Fields

§signed: bool
§bits: IntBits
§precision: Option<u16>
§

Decimal

GV17. Exact decimal, stored in the narrowest integer width that holds precision digits and scaled by scale.

Fields

§precision: u16
§scale: u16
§

Float

GV20 to GV26.

Fields

§precision: Option<u16>
§

Str

GV30 to GV32. Lengths are in characters, and a character is a Unicode scalar value. fixed is GV32, the one length constraint that changes the layout rather than adding a check.

Fields

§fixed: bool
§

Bytes

GV35 to GV38. Lengths are in octets.

Fields

§fixed: bool
§

Date

GV39. Proleptic Gregorian, no zone.

§

LocalTime

GV39. Time of day with no zone and therefore no DST.

§

LocalDatetime

GV39. An instant with no zone.

§

ZonedTime

GV40. Time of day with an offset from UTC in minutes.

§

ZonedDatetime

GV40. An instant with an offset from UTC in minutes.

§

Duration(DurationKind)

GV41.

§

Node(Option<String>)

A node reference, optionally of a named node type.

§

Edge(Option<String>)

An edge reference, optionally of a named edge type.

§

Graph(Option<String>)

GV60. A graph handle: a catalog id and a snapshot epoch, not data. Making it a value is what turns USE from a statement prefix into something composable.

§

BindingTable(Option<RecordType>)

GV61. A binding table handle, with the record type of its rows when that is known.

§

Path(Option<Box<PathType>>)

GV55. A path, whose type describes the alternating node and edge types it walks.

§

List

GV50.

Fields

§

Record(RecordType)

GV45 to GV48.

§

Any

GV65 and GV66. The open dynamic union: any type at all.

§

Union(Vec<LogicalType>)

GV67. A closed dynamic union, ANY<INT|STRING>.

§

AnyProperty

GV68. Any type a property may hold, which is Any minus the reference and constructed types.

§

Nullable(Box<LogicalType>)

GV90, orthogonal to everything above. Nullability is a wrapper and not a flag on each variant, so no variant can forget it.

Implementations§

Source§

impl LogicalType

Source

pub fn nullable(self) -> LogicalType

A nullable version of this type, without stacking wrappers.

Source

pub fn is_nullable(&self) -> bool

Whether a value of this type may be null. NULL itself is nullable and nothing else is unless it says so, which is the GV90 reading: a declared type is not null until wrapped.

Source

pub fn base(&self) -> &LogicalType

This type with any nullability wrapper removed, which is the form every layout question is asked about.

Source

pub fn is_material(&self) -> bool

Whether this type may hold a value at all. The immaterial types (GV71, GV72) cannot: NOTHING has no values and NULL has one that is never stored in a vector.

Source

pub fn physical(&self) -> Option<PhysicalType>

The layout a vector of this type uses, or None when there is nothing to lay out.

The dynamic unions map to Struct, which holds a type code child and one child per member. That is the one construct in the system that puts a tag back next to each value, and it is confined to columns declared as unions, which in practice is the schemaless ingest path and nothing else.

Source

pub fn int(bits: IntBits) -> LogicalType

The common integer spellings, so a caller does not write the struct out to say BIGINT.

Source

pub fn uint(bits: IntBits) -> LogicalType

Source

pub fn float(bits: FloatBits) -> LogicalType

Source

pub fn string() -> LogicalType

A string with no length constraint.

Source

pub fn bytes() -> LogicalType

A byte string with no length constraint.

Trait Implementations§

Source§

impl Clone for LogicalType

Source§

fn clone(&self) -> Self

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 LogicalType

Source§

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

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

impl Display for LogicalType

Source§

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

The spelling that goes in a diagnostic record, so the two type names in a 22G0x say what the user wrote rather than what the enum looks like.

Source§

impl Eq for LogicalType

Source§

impl Hash for LogicalType

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 LogicalType

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LogicalType

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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, !>

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.