pub unsafe trait Row<'stmt>where
Self: Sized,{
// Required method
fn from_row(stmt: &'stmt mut Statement) -> Result<Self, Error>;
}Expand description
This allows a type to be constructed from a Statement using next,
iter, or row.
This is typically implemented with the Row derive.
§Safety
The caller must ensure that the implementation of from_row only reads
distinct rows. Attempting to read the same row multiple times may lead to
invalidation of the column value leading to undefined behavior.
This is guaranteed by the Row derive and any internal implementations.
§Examples
The simplest implementation for Row is provided by tuples.
use sqll::{Connection, Row};
let mut c = Connection::open_in_memory()?;
c.execute(r#"
CREATE TABLE users (name TEXT, age INTEGER);
INSERT INTO users VALUES ('Alice', 42);
INSERT INTO users VALUES ('Bob', 72);
"#)?;
let mut results = c.prepare("SELECT name, age FROM users ORDER BY age")?;
while let Some((name, age)) = results.next::<(&str, u32)>()? {
println!("{name} is {age} years old");
}It can also be derived on a custom struct:
use sqll::{Connection, Row};
#[derive(Row)]
struct Person<'stmt> {
name: &'stmt str,
age: u32,
}
#[derive(Row)]
struct PersonTuple<'stmt>(&'stmt str, u32);
let mut c = Connection::open_in_memory()?;
c.execute(r#"
CREATE TABLE users (name TEXT, age INTEGER);
INSERT INTO users VALUES ('Alice', 42);
INSERT INTO users VALUES ('Bob', 72);
"#)?;
let mut results = c.prepare("SELECT name, age FROM users ORDER BY age")?;
while let Some(person) = results.next::<Person<'_>>()? {
println!("{} is {} years old", person.name, person.age);
}
results.reset()?;
while let Some(PersonTuple(name, age)) = results.next::<PersonTuple<'_>>()? {
println!("{name} is {age} years old");
}Convert into an owned type:
use sqll::{Connection, Row};
#[derive(Row)]
struct Person {
name: String,
age: u32,
}
#[derive(Row)]
struct PersonTuple(String, u32);
let mut c = Connection::open_in_memory()?;
c.execute(r#"
CREATE TABLE users (name TEXT, age INTEGER);
INSERT INTO users VALUES ('Alice', 42);
INSERT INTO users VALUES ('Bob', 72);
"#)?;
let mut stmt = c.prepare("SELECT name, age FROM users ORDER BY age")?;
while stmt.step()?.is_row() {
let person = stmt.row::<Person>()?;
println!("{} is {} years old", person.name, person.age);
let PersonTuple(name, age) = stmt.row::<PersonTuple>()?;
println!("{name} is {age} years old");
}Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'stmt, A> Row<'stmt> for (A,)where
A: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A> Row<'stmt> for (A,)where
A: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER)")?;
c.execute("INSERT INTO users VALUES (0)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a,)) = stmt.next::<(i64,)>()? {
assert_eq!(a, 0);
}Source§impl<'stmt, A, B> Row<'stmt> for (A, B)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B> Row<'stmt> for (A, B)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b,)) = stmt.next::<(i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
}Source§impl<'stmt, A, B, C> Row<'stmt> for (A, B, C)
Row implementation for a tuple.
impl<'stmt, A, B, C> Row<'stmt> for (A, B, C)
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c,)) = stmt.next::<(i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
}Source§impl<'stmt, A, B, C, D> Row<'stmt> for (A, B, C, D)
Row implementation for a tuple.
impl<'stmt, A, B, C, D> Row<'stmt> for (A, B, C, D)
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d,)) = stmt.next::<(i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
}Source§impl<'stmt, A, B, C, D, E> Row<'stmt> for (A, B, C, D, E)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E> Row<'stmt> for (A, B, C, D, E)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e,)) = stmt.next::<(i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
}Source§impl<'stmt, A, B, C, D, E, F> Row<'stmt> for (A, B, C, D, E, F)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F> Row<'stmt> for (A, B, C, D, E, F)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f,)) = stmt.next::<(i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
}Source§impl<'stmt, A, B, C, D, E, F, G> Row<'stmt> for (A, B, C, D, E, F, G)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G> Row<'stmt> for (A, B, C, D, E, F, G)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
}Source§impl<'stmt, A, B, C, D, E, F, G, H> Row<'stmt> for (A, B, C, D, E, F, G, H)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H> Row<'stmt> for (A, B, C, D, E, F, G, H)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I> Row<'stmt> for (A, B, C, D, E, F, G, H, I)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I> Row<'stmt> for (A, B, C, D, E, F, G, H, I)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I, J> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I, J> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER, j INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i, j,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
assert_eq!(j, 9);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I, J, K> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I, J, K> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER, j INTEGER, k INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i, j, k,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
assert_eq!(j, 9);
assert_eq!(k, 10);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER, j INTEGER, k INTEGER, l INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i, j, k, l,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
assert_eq!(j, 9);
assert_eq!(k, 10);
assert_eq!(l, 11);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L, M> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L, M)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
M: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L, M> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L, M)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
M: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER, j INTEGER, k INTEGER, l INTEGER, m INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i, j, k, l, m,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
assert_eq!(j, 9);
assert_eq!(k, 10);
assert_eq!(l, 11);
assert_eq!(m, 12);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L, M, N> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
M: FromColumn<'stmt>,
N: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L, M, N> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
M: FromColumn<'stmt>,
N: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER, j INTEGER, k INTEGER, l INTEGER, m INTEGER, n INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i, j, k, l, m, n,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
assert_eq!(j, 9);
assert_eq!(k, 10);
assert_eq!(l, 11);
assert_eq!(m, 12);
assert_eq!(n, 13);
}Source§impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
M: FromColumn<'stmt>,
N: FromColumn<'stmt>,
O: FromColumn<'stmt>,
Row implementation for a tuple.
impl<'stmt, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O> Row<'stmt> for (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)where
A: FromColumn<'stmt>,
B: FromColumn<'stmt>,
C: FromColumn<'stmt>,
D: FromColumn<'stmt>,
E: FromColumn<'stmt>,
F: FromColumn<'stmt>,
G: FromColumn<'stmt>,
H: FromColumn<'stmt>,
I: FromColumn<'stmt>,
J: FromColumn<'stmt>,
K: FromColumn<'stmt>,
L: FromColumn<'stmt>,
M: FromColumn<'stmt>,
N: FromColumn<'stmt>,
O: FromColumn<'stmt>,
Row implementation for a tuple.
A tuple reads elements one after another, starting at the first index.
§Examples
use sqll::Connection;
let c = Connection::open_in_memory()?;
c.execute("CREATE TABLE users (a INTEGER, b INTEGER, c INTEGER, d INTEGER, e INTEGER, f INTEGER, g INTEGER, h INTEGER, i INTEGER, j INTEGER, k INTEGER, l INTEGER, m INTEGER, n INTEGER, o INTEGER)")?;
c.execute("INSERT INTO users VALUES (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14)")?;
let mut stmt = c.prepare("SELECT * FROM users")?;
while let Some((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o,)) = stmt.next::<(i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64,)>()? {
assert_eq!(a, 0);
assert_eq!(b, 1);
assert_eq!(c, 2);
assert_eq!(d, 3);
assert_eq!(e, 4);
assert_eq!(f, 5);
assert_eq!(g, 6);
assert_eq!(h, 7);
assert_eq!(i, 8);
assert_eq!(j, 9);
assert_eq!(k, 10);
assert_eq!(l, 11);
assert_eq!(m, 12);
assert_eq!(n, 13);
assert_eq!(o, 14);
}