> For the complete documentation index, see [llms.txt](https://ciusji.gitbook.io/guinsoo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ciusji.gitbook.io/guinsoo/guides/tutorial/clients-for-guinsoo/rust.md).

# Rust

{% hint style="info" %}
The database was created as **`MODE=PostgreSQL`**.

MySQL or others dialogs can be created.
{% endhint %}

```rust
use postgres::{Client, NoTls, Error};

fn main() -> Result<(), Error> {
    let mut client = Client::connect("sa:sa@localhost:5435/test", NoTls)?;
    
    client.batch_execute("
        CREATE TABLE IF NOT EXISTS author (
            id              SERIAL PRIMARY KEY,
            name            VARCHAR NOT NULL,
            country         VARCHAR NOT NULL
            )
    ")?;

    client.batch_execute("
        CREATE TABLE IF NOT EXISTS book  (
            id              SERIAL PRIMARY KEY,
            title           VARCHAR NOT NULL,
            author_id       INTEGER NOT NULL REFERENCES author
            )
    ")?;

    Ok(())

}

```
