Debian Codegraph @

src/type_info.rs

raw symbols SCIP
1 use std::fmt::{Debug, Display};
2
3 /// Provides information about a SQL type for the database driver.
4 pub trait TypeInfo: Debug + Display + Clone + PartialEq<Self> + Send + Sync {
5 fn is_null(&self) -> bool;
6
7 /// Returns the database system name of the type. Length specifiers should not be included.
8 /// Common type names are `VARCHAR`, `TEXT`, or `INT`. Type names should be uppercase. They
9 /// should be a rough approximation of how they are written in SQL in the given database.
10 fn name(&self) -> &str;
11
12 /// Return `true` if `self` and `other` represent mutually compatible types.
13 ///
14 /// Defaults to `self == other`.
15 fn type_compatible(&self, other: &Self) -> bool
16 where
17 Self: Sized,
18 {
19 self == other
20 }
21
22 #[doc(hidden)]
23 fn is_void(&self) -> bool {
24 false
25 }
26 }