diff --git a/sqlx-core/src/type_info.rs b/sqlx-core/src/type_info.rs index bf698251..49fcc16b 100644 --- a/sqlx-core/src/type_info.rs +++ b/sqlx-core/src/type_info.rs @@ -1,3 +1,13 @@ use std::fmt::{Debug, Display}; -pub trait TypeInfo: Debug + Display + Clone + PartialEq {} +/// Provides information about a SQL type for the database driver. +/// +/// Currently this only exposes type equality rules that should roughly match the interpretation +/// in a given database (e.g., in PostgreSQL `VARCHAR` and `TEXT` are roughly equivalent +/// apart from storage). +pub trait TypeInfo: Debug + Display + Clone + PartialEq { + /// Returns the database system name of the type. Length specifiers should not be included. + /// Common type names are `VARCHAR`, `TEXT`, or `INT`. Type names should be uppercase. They + /// should be a rough approximation of how they are written in SQL in the given database. + fn name(&self) -> &str; +}