Skip to main content

insert

Function insert 

Source
pub fn insert(
    entity: &ResolvedEntity,
    body: &HashMap<String, Value>,
    include_pk: bool,
    schema_override: Option<&str>,
    rls_tenant_id: Option<&str>,
    caller_user_id: Option<&str>,
    dialect: &dyn Dialect,
) -> QueryBuf
Expand description

INSERT: columns and placeholders from entity; values from body. Excludes PK if has_default. Omits columns with DB default when body does not provide a value (so DB uses default). Uses SQL cast (e.g. $n::timestamptz) for timestamp columns so string values bind correctly. When rls_tenant_id is Some, appends tenant_id column and value (for RLS strategy).