pub enum FlussoType {
Show 19 variants
Text,
Identifier,
Keyword,
Enum,
Uuid,
Boolean,
Short,
Integer,
Long,
Float,
Double,
Decimal,
Date,
Timestamp,
Binary,
Json,
Map {
values: Box<FlussoType>,
},
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→ OStext.
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.
Map
A dynamic-key object: a json/jsonb column whose keys are
runtime-determined but whose values all share one leaf type (e.g.
translations {"en": …, "it": …}). Maps to OS object with
dynamic: true, so unmapped keys stay full-text searchable without
enumerating them in the schema. values is the leaf type of every value.
Fields
values: Box<FlussoType>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, …).
Implementations§
Source§impl FlussoType
impl FlussoType
Sourcepub fn opensearch(&self) -> MappingType
pub fn opensearch(&self) -> MappingType
The OpenSearch MappingType this declared type maps to.
Sourcepub fn accepts_pg(&self, sql_type: &str) -> bool
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
impl Clone for FlussoType
Source§fn clone(&self) -> FlussoType
fn clone(&self) -> FlussoType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FlussoType
impl Debug for FlussoType
Source§impl<'de> Deserialize<'de> for FlussoType
impl<'de> Deserialize<'de> for FlussoType
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FlussoType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FlussoType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for FlussoType
Source§impl Hash for FlussoType
impl Hash for FlussoType
Source§impl PartialEq for FlussoType
impl PartialEq for FlussoType
Source§fn eq(&self, other: &FlussoType) -> bool
fn eq(&self, other: &FlussoType) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for FlussoType
impl Serialize for FlussoType
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for FlussoType
Auto Trait Implementations§
impl Freeze for FlussoType
impl RefUnwindSafe for FlussoType
impl Send for FlussoType
impl Sync for FlussoType
impl Unpin for FlussoType
impl UnsafeUnpin for FlussoType
impl UnwindSafe for FlussoType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.