/ars-postgres

a postgresql binding for neut

Primary LanguageCMIT LicenseMIT

ars-postgres

ars-postgres is a PostgreSQL binding for the Neut programming language.

Installation

Add this module to your project:

neut get ars-postgres https://github.com/vekatze/ars-postgres/raw/main/archive/0-1-15.tar.zst

Install libpq and pkg-config:

# Debian
apt install libpq-dev pkg-config

# Ubuntu
apt install libpq-dev pkg-config

# macOS
brew install libpq pkg-config

On macOS, set:

export PKG_CONFIG_PATH=/opt/homebrew/opt/libpq/lib/pkgconfig:$PKG_CONFIG_PATH

Ensure that the following command runs successfully:

pkg-config libpq --libs --cflags

Finally, edit your app's build-option into something like the following:

{
  // ...
  target {
    your-app {
      main "your-app.nt",
      build-option [                           //
        "$(pkg-config libpq --libs --cflags)", // ← add this
      ],                                       //
    },
  },
  // ...
}

Test

# macOS
docker compose up -d
neut build test --execute
# => creates tables, inserts rows, selects rows, and prints them

Please refer to source/test.nt to see how to use this module (for now).