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§
- Creates a
(Identifier, Column)pair for a bigint column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for a boolean column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for a decimal75 column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for an int column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for an int128 column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for a scalar column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for a smallint column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for a timestamp column. This is primarily intended for use in conjunction withtable. - Creates a (Identifier,
Column) pair for a tinyint column. This is primarily intended for use in conjunction withtable. - Creates a
(Identifier, Column)pair for a varchar column. This is primarily intended for use in conjunction withtable. - Creates an
Tablefrom a list of(Identifier, Column)pairs. This is a convenience wrapper aroundTable::try_from_iterprimarily 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. SeeTable::try_from_iterfor more details. - Creates an
Tablefrom a list of(Identifier, 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.