Skip to main content

FlussoType

Enum FlussoType 

Source
pub enum FlussoType {
Show 18 variants Text, Identifier, Keyword, Enum, Uuid, Boolean, Short, Integer, Long, Float, Double, Decimal, Date, Timestamp, Binary, Json, GeoPoint, Custom { postgres: Vec<String>, opensearch: String, },
}
Expand description

The declared type of a leaf field — the single vocabulary that bridges a Postgres column type and an OpenSearch mapping type.

A self-describing schema names one of these per scalar field, so the document shape (and the index mapping) is known without ever touching the database. A variant pins both ends: which Postgres types satisfy it (for validation, when a database is reachable) and which OpenSearch MappingType it emits. That is what lets the two disagree on purpose — an Enum is stored as text in Postgres but must be a keyword in OpenSearch.

Variants§

§

Text

Analyzed natural-language full text — descriptions, bios, comments. The default analyzed type; carries the flusso_text analyzer (plain tokenize

  • accent/case fold). PG text / varchar → OS text.
§

Identifier

Identifier-like short text — names, SKUs, codes, statuses. Analyzed with the flusso_code analyzer, which splits on punctuation/case so C-01234 is found by c01234 or 01234. PG text / varchar → OS text.

§

Keyword

Exact, aggregatable token. PG text / varchar → OS keyword.

§

Enum

A closed set of string values — stored as text in Postgres (a varchar or a PG enum), indexed exactly as a keyword.

§

Uuid

PG uuid → OS keyword.

§

Boolean

PG boolean → OS boolean.

§

Short

PG smallint / int2 → OS short.

§

Integer

PG integer / int4 → OS integer.

§

Long

PG bigint / int8 → OS long.

§

Float

PG real / float4 → OS float.

§

Double

PG double precision / float8 → OS double.

§

Decimal

PG numeric / decimal / money → OS double (lossy but searchable; declare Custom scaled_float when exactness matters).

§

Date

PG date → OS date.

§

Timestamp

PG timestamp / timestamptz / time → OS date.

§

Binary

PG bytea → OS binary.

§

Json

PG json / jsonb → OS object.

§

GeoPoint

A geographic point → OS geo_point.

The document is assembled server-side as JSON, so the source column must already hold a value OpenSearch accepts as a geo_point and that carries through JSON verbatim: json/jsonb shaped as {"lat": …, "lon": …} or [lon, lat], or text as "lat,lon". A PostGIS geometry or PG-native point is not accepted — it would serialize as WKB / (x,y); expose a generated jsonb/text column in that shape instead.

§

Custom

An escape hatch: an explicit OpenSearch type with the Postgres types it accepts, for anything the named variants don’t cover (geo_shape, scaled_float, …).

Fields

§postgres: Vec<String>
§opensearch: String

Implementations§

Source§

impl FlussoType

Source

pub fn opensearch(&self) -> MappingType

The OpenSearch MappingType this declared type maps to.

Source

pub fn accepts_pg(&self, sql_type: &str) -> bool

Whether sql_type (a Postgres type name as format_type reports it, e.g. bigint, character varying(255), numeric(10,2), integer[]) is a Postgres type this declared type accepts. Used to validate a declared schema against a live database; with no database, it is never consulted.

Trait Implementations§

Source§

impl Clone for FlussoType

Source§

fn clone(&self) -> FlussoType

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 FlussoType

Source§

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

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

impl<'de> Deserialize<'de> for FlussoType

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<FlussoType, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for FlussoType

Source§

impl Hash for FlussoType

Source§

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

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 FlussoType

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 FlussoType

Source§

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

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

impl StructuralPartialEq for FlussoType

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.