Interface Row

An object containing a single row of the query result.

Indexable

  • [key: string]: unknown

    Each column has a property with the same name as the column name. The value of the property contains the value of the given column in the current row.

    The value of the property is automatically mapped to the corresponding JavaScript type.

     import sql from "k6/x/sql";

    // the actual database driver should be used instead of ramsql
    import driver from "k6/x/sql/driver/ramsql";

    const db = sql.open(driver, "roster_db");

    export default function () {
    let rows = db.query("SELECT * FROM roster WHERE given_name = $1;", "Peter");
    for (const row of results) {
    console.log(`${row.family_name}, ${row.given_name}`);
    }
    }