pgrx_sql_entity_graph::metadata

Trait SqlTranslatable

Source
pub unsafe trait SqlTranslatable {
    // Required methods
    fn argument_sql() -> Result<SqlMapping, ArgumentError>;
    fn return_sql() -> Result<Returns, ReturnsError>;

    // Provided methods
    fn type_name() -> &'static str { ... }
    fn variadic() -> bool { ... }
    fn optional() -> bool { ... }
    fn entity() -> FunctionMetadataTypeEntity { ... }
}
Expand description

A value which can be represented in SQL

§Safety

By implementing this, you assert you are not lying to either Postgres or Rust in doing so. This trait asserts a safe translation exists between values of this type from Rust to SQL, or from SQL into Rust. If you are mistaken about how this works, either the Postgres C API or the Rust handling in PGRX may emit undefined behavior.

It cannot be made private or sealed due to details of the structure of the PGRX framework. Nonetheless, if you are not confident the translation is valid: do not implement this trait.

Required Methods§

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl SqlTranslatable for bool

Source§

impl SqlTranslatable for char

Source§

impl SqlTranslatable for f32

Source§

impl SqlTranslatable for f64

Source§

impl SqlTranslatable for i8

Source§

impl SqlTranslatable for i16

Source§

impl SqlTranslatable for i32

Source§

impl SqlTranslatable for i64

Source§

impl SqlTranslatable for str

Source§

impl SqlTranslatable for u8

Source§

impl SqlTranslatable for ()

Source§

impl SqlTranslatable for CString

Source§

impl SqlTranslatable for String

Source§

impl SqlTranslatable for CStr

Source§

impl SqlTranslatable for [u8]

Source§

impl<T> SqlTranslatable for Option<T>
where T: SqlTranslatable,

Source§

impl<T> SqlTranslatable for *mut T
where T: SqlTranslatable,

Source§

impl<T> SqlTranslatable for &T
where T: ?Sized + SqlTranslatable,

Source§

impl<T> SqlTranslatable for Vec<T>
where T: SqlTranslatable,

Source§

impl<T, E> SqlTranslatable for Result<T, E>
where T: SqlTranslatable, E: Any + Display,

Implementors§