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

    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 PGX may emit undefined behavior.

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

Required Methods§

Provided Methods§

Implementations on Foreign Types§

Implementors§