Derive Macro pgrx::PostgresHash

source ·
#[derive(PostgresHash)]
{
    // Attributes available to this derive:
    #[pgrx]
}
Expand description

Generate necessary code for stable hashing the type so it can be used with USING hash indexes.

use pgrx::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Hash, PostgresEnum, PostgresHash)]
enum DogNames {
    Nami,
    Brandy,
}

Optionally accepts the following attributes:

§No bounds?

Unlike some derives, this does not implement a “real” Rust trait, thus PostgresHash cannot be used in trait bounds, nor can it be manually implemented.