Skip to main content

Update

Type Alias Update 

Source
pub type Update<'a, ET> = Update<'a, ET, Postgres, DataKind>;
Expand description

Update builder type alias for PostgreSQL
PostgreSQL 的 Update 构建器类型别名

Used to build UPDATE statements for PostgreSQL databases. Provides methods to update records with flexible WHERE clauses and SET operations.

用于为 PostgreSQL 数据库构建 UPDATE 语句。提供使用灵活的 WHERE 子句和 SET 操作更新记录的方法。

§Type Parameters

  • ET - The entity type that this update builder operates on
  • ET - 此更新构建器操作的实体类型

§Public Methods

  • one - Create a single entity update operation
  • table - Create an Update instance with the default table name
  • with_table - Create an Update instance with a custom table name
  • from_query - Create an Update instance from a query
  • from_query_with_table - Create an Update instance from a query with a custom table name
  • custom - Custom SET columns or other query statements
  • filter - Add WHERE condition to the update statement
  • returning - Add RETURNING clause to the update statement
  • finish - Finish building, get the internal QueryBuilder

§公共方法

  • one - 创建单个实体更新操作
  • table - 创建使用默认表名的 Update 实例
  • with_table - 创建使用自定义表名的 Update 实例
  • from_query - 从外部查询中创建 Update 实例
  • from_query_with_table - 从外部查询中创建 Update 实例,可以自定义表名
  • custom - 自定义 SET 列或其他查询语句
  • filter - 向查询中添加过滤查询部分
  • returning - 添加 RETURNING 子句到更新语句
  • finish - 结束构建,获取内部的 QueryBuilder

§Examples

use kitx::postgres::builder::Update;
 
let entity = User { id: 1, name: "Bob".to_string() };
let update_query = Update::one(&entity, &PRIMARY_KEY, true).unwrap();

Aliased Type§

pub struct Update<'a, ET> { /* private fields */ }