<commit_before>rust-postgres-cursor
====================

A cursor type for use with PostgreSQL.

## Example

```rust
extern crate postgres;
extern crate postgres_cursor;

use postgres::{Connection, TlsMode};
use postgres_cursor::Cursor;

fn main() {
    // First, establish a connection with postgres
    let conn = Connection::connect("postgres://jwilm@127.0.0.1/foo", TlsMode::None)
        .expect("connect");

    // Build the cursor
    let mut cursor = Cursor::build(&conn)
        // Batch size determines rows returned in each FETCH call
        .batch_size(10)
        // Query is the statement to build a cursor for
        .query("SELECT id FROM products")
        // Finalize turns this builder into a cursor
        .finalize();

    // Iterate over batches of rows
    for result in cursor.iter().unwrap() {
        // Each item returned from the iterator is a Result<Rows>.
        // This is because each call to `next()` makes a query
        // to the database.
        let rows = result.unwrap();

        // After handling errors, rows returned in this iteration
        // can be iterated over.
        for row in &rows {
            println!("{:?}", row);
        }
    }
}
```
<commit_msg>Update README with planned features<commit_after>rust-postgres-cursor
====================

A cursor type for use with PostgreSQL.

## Example

```rust
extern crate postgres;
extern crate postgres_cursor;

use postgres::{Connection, TlsMode};
use postgres_cursor::Cursor;

fn main() {
    // First, establish a connection with postgres
    let conn = Connection::connect("postgres://jwilm@127.0.0.1/foo", TlsMode::None)
        .expect("connect");

    // Build the cursor
    let mut cursor = Cursor::build(&conn)
        // Batch size determines rows returned in each FETCH call
        .batch_size(10)
        // Query is the statement to build a cursor for
        .query("SELECT id FROM products")
        // Finalize turns this builder into a cursor
        .finalize();

    // Iterate over batches of rows
    for result in cursor.iter().unwrap() {
        // Each item returned from the iterator is a Result<Rows>.
        // This is because each call to `next()` makes a query
        // to the database.
        let rows = result.unwrap();

        // After handling errors, rows returned in this iteration
        // can be iterated over.
        for row in &rows {
            println!("{:?}", row);
        }
    }
}
```

## Features

The library is mostly complete since its only intent is providing a cursor
abstraction. However, there are some small planned features worth noting:

- [ ] Support query parameters (eg. `"SELECT foo FROM bar WHERE quux = $1"`) in
      cursor query string.

{'fraction_non_alphanumeric': 0.11769032732622288, 'fraction_numerical': 0.00625229863920559, 'mean_word_length': 2.5142118863049094, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6376924', 'n_tokens_mistral': 755, 'n_tokens_neox': 732, 'n_words': 291}