MCPcopy Create free account
hub / github.com/hashintel/hash / from_sql

Method from_sql

libs/@local/graph/store/src/query/pagination.rs:56–68  ·  view source on GitHub ↗
(ty: &Type, raw: &[u8])

Source from the content-addressed store, hash-verified

54 );
55
56 fn from_sql(ty: &Type, raw: &[u8]) -> Result<Self, Box<dyn Error + Sync + Send>> {
57 match *ty {
58 Type::BOOL => Ok(Self::Bool(bool::from_sql(ty, raw)?)),
59 Type::INT4 => Ok(Self::I32(i32::from_sql(ty, raw)?)),
60 Type::FLOAT8 => Ok(Self::F64(f64::from_sql(ty, raw)?)),
61 Type::TEXT | Type::VARCHAR => Ok(Self::String(Cow::Owned(String::from_sql(ty, raw)?))),
62 Type::TIMESTAMPTZ => Ok(Self::Timestamp(Timestamp::from_sql(ty, raw)?)),
63 Type::TSTZ_RANGE => Ok(Self::TimeInterval(TemporalInterval::from_sql(ty, raw)?)),
64 Type::JSONB => Ok(Self::Json(PropertyValue::from_sql(ty, raw)?)),
65 Type::UUID => Ok(Self::Uuid(Uuid::from_sql(ty, raw)?)),
66 _ => Err(format!("Unsupported type: {ty}").into()),
67 }
68 }
69
70 fn from_sql_null(ty: &Type) -> Result<Self, Box<dyn Error + Sync + Send>> {
71 match *ty {

Callers

nothing calls this directly

Calls 7

OkInterface · 0.85
BoolClass · 0.85
StringClass · 0.85
UuidClass · 0.85
ErrInterface · 0.85
TimestampClass · 0.50
JsonClass · 0.50

Tested by

no test coverage detected