Expand description
Utility functions for creating Table
s and Column
s.
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 withtable
. - borrowed_
boolean - Creates a
(Ident, Column)
pair for a boolean column. This is primarily intended for use in conjunction withtable
. - borrowed_
decimal75 - Creates a
(Ident, Column)
pair for a decimal75 column. This is primarily intended for use in conjunction withtable
. - borrowed_
int - Creates a
(Ident, Column)
pair for an int column. This is primarily intended for use in conjunction withtable
. - borrowed_
int128 - Creates a
(Ident, Column)
pair for an int128 column. This is primarily intended for use in conjunction withtable
. - borrowed_
scalar - Creates a
(Ident, Column)
pair for a scalar column. This is primarily intended for use in conjunction withtable
. - borrowed_
smallint - Creates a
(Ident, Column)
pair for a smallint column. This is primarily intended for use in conjunction withtable
. - borrowed_
timestamptz - Creates a
(Ident, Column)
pair for a timestamp column. This is primarily intended for use in conjunction withtable
. - borrowed_
tinyint - Creates a (Ident,
Column
) pair for a tinyint column. This is primarily intended for use in conjunction withtable
. - borrowed_
uint8 - Creates a (Ident,
Column
) pair for a uint8 column. This is primarily intended for use in conjunction withtable
. - borrowed_
varchar - Creates a
(Ident, Column)
pair for a varchar column. This is primarily intended for use in conjunction withtable
. - table
- Creates an
Table
from a list of(Ident, Column)
pairs. This is a convenience wrapper aroundTable::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. SeeTable::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.