Skip to main content

JsonbOperand

Trait JsonbOperand 

Source
pub trait JsonbOperand { }
Expand description

SQL types accepted as the right operand of jsonb_contains (@>) and jsonb_contained (<@).

The operand is rendered as CAST(operand AS JSONB), so it may be json, jsonb, JSON text (text, varchar, such as a &str literal), or untyped SQL (Any). Other types, such as integers, are rejected.

§Type safety

ⓘ
use drizzle_core::expr::raw_non_null;
use drizzle_postgres::expr::jsonb_contains;
use drizzle_postgres::values::PostgresValue;
use drizzle_types::postgres::types::Jsonb;

let data = raw_non_null::<PostgresValue, Jsonb>("data");
let _ = jsonb_contains(data, 42_i32); // an integer is not JSON

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§