Trait pgrx::datum::WithTypeIds
source · pub trait WithTypeIds {
const ITEM_ID: Lazy<TypeId>;
const OPTION_ID: Lazy<Option<TypeId>>;
const VEC_ID: Lazy<Option<TypeId>>;
const VEC_OPTION_ID: Lazy<Option<TypeId>>;
const OPTION_VEC_ID: Lazy<Option<TypeId>>;
const OPTION_VEC_OPTION_ID: Lazy<Option<TypeId>>;
const ARRAY_ID: Lazy<Option<TypeId>>;
const OPTION_ARRAY_ID: Lazy<Option<TypeId>>;
const VARIADICARRAY_ID: Lazy<Option<TypeId>>;
const OPTION_VARIADICARRAY_ID: Lazy<Option<TypeId>>;
const VARLENA_ID: Lazy<Option<TypeId>>;
const OPTION_VARLENA_ID: Lazy<Option<TypeId>>;
// Provided methods
fn register_with_refs(map: &mut HashSet<RustSqlMapping>, single_sql: String)
where Self: 'static { ... }
fn register_sized_with_refs(
_map: &mut HashSet<RustSqlMapping>,
_single_sql: String
)
where Self: 'static { ... }
fn register_sized(_map: &mut HashSet<RustSqlMapping>, _single_sql: String)
where Self: 'static { ... }
fn register_varlena_with_refs(
_map: &mut HashSet<RustSqlMapping>,
_single_sql: String
)
where Self: 'static { ... }
fn register_varlena(_map: &mut HashSet<RustSqlMapping>, _single_sql: String)
where Self: 'static { ... }
fn register_array_with_refs(
_map: &mut HashSet<RustSqlMapping>,
_single_sql: String
)
where Self: 'static { ... }
fn register_array(_map: &mut HashSet<RustSqlMapping>, _single_sql: String)
where Self: 'static { ... }
fn register(set: &mut HashSet<RustSqlMapping>, single_sql: String)
where Self: 'static { ... }
}
Expand description
A type which can have it’s core::any::TypeId
s registered for Rust to SQL mapping.
An example use of this trait:
use pgrx::prelude::*;
use serde::{Serialize, Deserialize};
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PostgresType)]
struct Treat<'a> { best_part: &'a str, };
let mut mappings = Default::default();
let treat_string = stringify!(Treat).to_string();
<Treat<'static> as pgrx::datum::WithTypeIds>::register_with_refs(&mut mappings, treat_string.clone());
assert!(mappings.iter().any(|x| x.id == core::any::TypeId::of::<Treat<'static>>()));
This trait uses the fact that inherent implementations are a higher priority than trait implementations.
Required Associated Constants§
const ITEM_ID: Lazy<TypeId>
const OPTION_ID: Lazy<Option<TypeId>>
const VEC_ID: Lazy<Option<TypeId>>
const VEC_OPTION_ID: Lazy<Option<TypeId>>
const OPTION_VEC_ID: Lazy<Option<TypeId>>
const OPTION_VEC_OPTION_ID: Lazy<Option<TypeId>>
const ARRAY_ID: Lazy<Option<TypeId>>
const OPTION_ARRAY_ID: Lazy<Option<TypeId>>
const VARIADICARRAY_ID: Lazy<Option<TypeId>>
const OPTION_VARIADICARRAY_ID: Lazy<Option<TypeId>>
const VARLENA_ID: Lazy<Option<TypeId>>
const OPTION_VARLENA_ID: Lazy<Option<TypeId>>
Provided Methods§
fn register_with_refs(map: &mut HashSet<RustSqlMapping>, single_sql: String)where
Self: 'static,
fn register_sized_with_refs(
_map: &mut HashSet<RustSqlMapping>,
_single_sql: String
)where
Self: 'static,
fn register_sized(_map: &mut HashSet<RustSqlMapping>, _single_sql: String)where
Self: 'static,
fn register_varlena_with_refs(
_map: &mut HashSet<RustSqlMapping>,
_single_sql: String
)where
Self: 'static,
fn register_varlena(_map: &mut HashSet<RustSqlMapping>, _single_sql: String)where
Self: 'static,
fn register_array_with_refs(
_map: &mut HashSet<RustSqlMapping>,
_single_sql: String
)where
Self: 'static,
fn register_array(_map: &mut HashSet<RustSqlMapping>, _single_sql: String)where
Self: 'static,
fn register(set: &mut HashSet<RustSqlMapping>, single_sql: String)where
Self: 'static,
Object Safety§
This trait is not object safe.