Struct postgres_cursor::Builder [] [src]

pub struct Builder<'conn, 'builder, D: ?Sized + 'builder> { /* fields omitted */ }

Builds a Cursor

This type is constructed by calling Cursor::build.

Methods

impl<'conn, 'builder, D: Display + ?Sized + 'builder> Builder<'conn, 'builder, D>
[src]

[src]

Set query params for cursor creation

[src]

Set the batch size passed to FETCH on each iteration.

Default is 5,000.

[src]

Set the tag for cursor name.

Adding a tag to the cursor name can be helpful for identifying where cursors originate when viewing pg_stat_activity.

Default is default.

Examples

Any type that implements fmt::Display may be provided as a tag. For example, a simple string literal is one option.

let mut cursor = Cursor::build(&conn)
    .tag("custom-cursor-tag")
    .finalize();

Or maybe you want to build a tag at run-time without incurring an extra allocation:

use std::fmt;

struct Pid(i32);
impl fmt::Display for Pid {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "pid-{}", self.0)
    }
}

let tag = Pid(8123);
let mut cursor = Cursor::build(&conn)
    .tag(&tag)
    .finalize();

[src]

Set the query to create a cursor for.

Default is SELECT 1.

[src]

Turn the builder into a Cursor.