Crate sqlx_template

Source

Attribute Macros§

delete
The delete procedural macro transforms an SQL DELETE query with named parameters into an asynchronous function that interacts with the database. It provides various features, including debugging options and support for returning the number of affected rows or no return value (void).
insert
The insert procedural macro transforms an SQL INSERT query with named parameters into an asynchronous function that interacts with the database. It provides various features, including debugging options and support for returning the number of affected rows or no return value (void).
multi_query
The multi_query procedural macro transforms a series of SQL queries with named parameters into an asynchronous function that interacts with the database. It provides various features, including debugging options, and is designed to handle multiple SQL statements with no return value (void).
query
The query procedural macro transforms an SQL query with named parameters into an asynchronous function that interacts with the database. It provides various features, including debugging options and support for multiple return types.
select
The select procedural macro transforms a SQL query with named parameters into an asynchronous function that interacts with the database. It provides various features, including debugging options and support for multiple return types.
update
The update procedural macro transforms an SQL UPDATE query with named parameters into an asynchronous function that interacts with the database. It provides various features, including debugging options and support for returning the number of affected rows.

Derive Macros§

Columns
DeleteTemplate
DeleteTemplate is a derive macro designed to automatically generate record deletion functions based on sqlx. This macro creates delete methods for the struct it is applied to, returning the number of records deleted. It assumes that the columns in the database correspond to the fields in the struct.
InsertTemplate
InsertTemplate is a derive macro designed to automatically generate record insert functions based on sqlx. This macro creates insert methods for the struct it is applied to, returning the number of new records added. It assumes that the columns in the database correspond to the fields in the struct.
SelectTemplate
SelectTemplate is a derive macro designed to automatically generate record retrieval functions based on sqlx. This macro creates various query methods for the struct it is applied to, returning records from the database, assuming that the columns in the database correspond to the fields in the struct.
TableName
The TableName derive macro automatically generates a table_name function for a struct, returning the value specified in the table_name attribute.
UpdateTemplate
UpdateTemplate is a derive macro designed to automatically generate record update functions based on sqlx. This macro creates update methods for the struct it is applied to, reducing repetitive code and improving the readability and maintainability of your code. It assumes that the columns in the database correspond to the fields in the struct.