Skip to main content

sql_statement

Attribute Macro sql_statement 

Source
#[sql_statement]
Expand description

This macro attribute is used to specify the SQL statement to be executed

use tokio_postgres::{Client as PgClient, Error as PgError};

#[sql_fun::sql_statement("create table users(id serial primary key, name text);")]
async fn create_table_users(client: &PgClient) -> Result<u64, PgError> {}

please set connector in Cargo.toml

[package.metadata.database]
connector = "tokio-postgres"

sql_fun supports only the tokio-postgres for database connector(currently).