Skip to main content

Insert

Type Alias Insert 

Source
pub type Insert<'a, ET> = Insert<'a, ET, MySql, DataKind>;
Expand description

Insert builder type alias for MySQL
MySQL 的 Insert 构建器类型别名

Used to build INSERT statements for MySQL databases. Provides methods to insert single or multiple records in a type-safe manner.

用于为 MySQL 数据库构建 INSERT 语句。提供以类型安全的方式插入单个或多个记录的方法。

§Type Parameters

  • ET - The entity type that this insert builder operates on
  • ET - 此插入构建器操作的实体类型

§Public Methods

  • one - Create single record insert operation
  • many - Create multiple records insert operation
  • table - Create custom table and columns
  • with_table - Create a insert with a custom table name
  • from_query - Create an Insert instance from a query
  • from_query_with_table - Create an Insert instance from a query with a custom table name
  • custom - Custom VALUES or value-related query statements
  • finish - Finish building, get the internal QueryBuilder

§公共方法

  • one - 创建单条记录插入操作
  • many - 创建多条记录插入操作
  • table - 创建默认表名的插入操作
  • with_table - 创建带有自定义表名的插入操作
  • from_query - 从外部查询中创建 Insert 实例
  • from_query_with_table - 从外部查询中创建 Insert 实例,可以自定义表名
  • custom - 自定义 VALUES 或值相关的查询语句
  • finish - 结束构建,获取内部的 QueryBuilder

§Examples

use kitx::mysql::builder::Insert;
 
let entity = User { id: 1, name: "Alice".to_string() };
let insert_query = Insert::one(&entity, &PRIMARY_KEY).unwrap();

Aliased Type§

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