Module table_utility

Source
Expand description

Utility functions for creating Tables and Columns. These functions are primarily intended for use in tests.

§Example

use bumpalo::Bump;
use proof_of_sql::base::{database::table_utility::*, scalar::Curve25519Scalar};
let alloc = Bump::new();
let result = table::<Curve25519Scalar>([
    borrowed_bigint("a", [1, 2, 3], &alloc),
    borrowed_boolean("b", [true, false, true], &alloc),
    borrowed_int128("c", [1, 2, 3], &alloc),
    borrowed_scalar("d", [1, 2, 3], &alloc),
    borrowed_varchar("e", ["a", "b", "c"], &alloc),
    borrowed_decimal75("f", 12, 1, [1, 2, 3], &alloc),
]);

Functions§

borrowed_bigint
Creates a (Ident, Column) pair for a bigint column. This is primarily intended for use in conjunction with table.
borrowed_boolean
Creates a (Ident, Column) pair for a boolean column. This is primarily intended for use in conjunction with table.
borrowed_decimal75
Creates a (Ident, Column) pair for a decimal75 column. This is primarily intended for use in conjunction with table.
borrowed_int
Creates a (Ident, Column) pair for an int column. This is primarily intended for use in conjunction with table.
borrowed_int128
Creates a (Ident, Column) pair for an int128 column. This is primarily intended for use in conjunction with table.
borrowed_scalar
Creates a (Ident, Column) pair for a scalar column. This is primarily intended for use in conjunction with table.
borrowed_smallint
Creates a (Ident, Column) pair for a smallint column. This is primarily intended for use in conjunction with table.
borrowed_timestamptz
Creates a (Ident, Column) pair for a timestamp column. This is primarily intended for use in conjunction with table.
borrowed_tinyint
Creates a (Ident, Column) pair for a tinyint column. This is primarily intended for use in conjunction with table.
borrowed_uint8
Creates a (Ident, Column) pair for a uint8 column. This is primarily intended for use in conjunction with table.
borrowed_varchar
Creates a (Ident, Column) pair for a varchar column. This is primarily intended for use in conjunction with table.
table
Creates an Table from a list of (Ident, Column) pairs. This is a convenience wrapper around Table::try_from_iter primarily for use in tests and intended to be used along with the other methods in this module (e.g. borrowed_bigint, borrowed_boolean, etc). The function will panic under a variety of conditions. See Table::try_from_iter for more details.
table_with_row_count
Creates an Table from a list of (Ident, Column) pairs with a specified row count. The main reason for this function is to allow for creating tables that may potentially have no columns, but still have a specified row count.