Function table

Source
pub fn table<'a, S: Scalar>(
    iter: impl IntoIterator<Item = (Ident, Column<'a, S>)>,
) -> Table<'a, S>
Expand description

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.

§Example

use bumpalo::Bump;
use proof_of_sql::base::{database::table_utility::*};
let alloc = Bump::new();
let result = table::<MyScalar>([
    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),
]);

§Panics

  • Panics if converting the iterator into an Table<'a, S> fails.