MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / preferred_type

Method preferred_type

src/sql/src/func.rs:195–214  ·  view source on GitHub ↗

Extracted from PostgreSQL 9.6. ```ignore SELECT typcategory, typname, typispreferred FROM pg_catalog.pg_type WHERE typispreferred = true ORDER BY typcategory; ```

(&self)

Source from the content-addressed store, hash-verified

193 /// ORDER BY typcategory;
194 /// ```
195 pub fn preferred_type(&self) -> Option<SqlScalarType> {
196 match self {
197 Self::Array
198 | Self::BitString
199 | Self::Composite
200 | Self::Enum
201 | Self::Geometric
202 | Self::List
203 | Self::NetworkAddress
204 | Self::Pseudo
205 | Self::Range
206 | Self::Unknown
207 | Self::UserDefined => None,
208 Self::Boolean => Some(SqlScalarType::Bool),
209 Self::DateTime => Some(SqlScalarType::TimestampTz { precision: None }),
210 Self::Numeric => Some(SqlScalarType::Float64),
211 Self::String => Some(SqlScalarType::String),
212 Self::Timespan => Some(SqlScalarType::Interval),
213 }
214 }
215}
216
217/// Builds an expression that evaluates a scalar function on the provided

Callers 4

is_preferred_byMethod · 0.80
prefers_selfMethod · 0.80
find_matchFunction · 0.80
guess_best_common_typeFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected