pub async fn insert_jsonb_row(
client: &Client,
table_name: &str,
id: &str,
data: Value,
source_type: &str,
) -> Result<()>Expand description
Insert a single JSONB row with metadata
Inserts a single row into a JSONB table with the original ID, data, and metadata.
§Arguments
client- PostgreSQL client connectiontable_name- Name of the table (must be validated)id- Original document/row IDdata- Complete document/row as serde_json::Valuesource_type- Source database type (‘sqlite’, ‘mongodb’, or ‘mysql’)
§Security
Uses parameterized queries for id, data, and source_type to prevent injection. table_name must be validated before calling.
§Examples
let table_name = "users";
validate_table_name(table_name)?;
let data = json!({"name": "Alice", "age": 30});
insert_jsonb_row(client, table_name, "1", data, "sqlite").await?;