Skip to main content

JsonbType

Trait JsonbType 

Source
pub trait JsonbType { }
Expand description

SQL types the JSONB-only operators (@>, <@, ?, ?|, ?&) accept as their left operand.

Implemented for jsonb and untyped SQL (Any). PostgreSQL has none of these operators for json, so a json column is rejected.

§Type safety

ⓘ
use drizzle_core::expr::raw_non_null;
use drizzle_postgres::expr::jsonb_exists_key;
use drizzle_postgres::values::PostgresValue;
use drizzle_types::postgres::types::Json;

let data = raw_non_null::<PostgresValue, Json>("data");
let _ = jsonb_exists_key(data, "name"); // `json`, not `jsonb`

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§