pub struct DatabaseDataset { /* private fields */ }Expand description
Dataset that loads data from a database table
Implementations§
Source§impl DatabaseDataset
impl DatabaseDataset
Sourcepub fn new(
connection: Box<dyn DatabaseConnection>,
table_name: String,
columns: Option<Vec<String>>,
batch_size: Option<usize>,
) -> Result<Self, DatabaseError>
pub fn new( connection: Box<dyn DatabaseConnection>, table_name: String, columns: Option<Vec<String>>, batch_size: Option<usize>, ) -> Result<Self, DatabaseError>
Create a new database dataset
Sourcepub fn table_name(&self) -> &str
pub fn table_name(&self) -> &str
Get table name
Sourcepub fn read_batch(
&mut self,
start_idx: usize,
batch_size: usize,
) -> Result<Vec<DatabaseRow>, DatabaseError>
pub fn read_batch( &mut self, start_idx: usize, batch_size: usize, ) -> Result<Vec<DatabaseRow>, DatabaseError>
Read a batch of rows
Sourcepub fn rows_to_tensors<T: TensorElement>(
&self,
rows: &[DatabaseRow],
) -> Result<Vec<Tensor<T>>, DatabaseError>
pub fn rows_to_tensors<T: TensorElement>( &self, rows: &[DatabaseRow], ) -> Result<Vec<Tensor<T>>, DatabaseError>
Convert rows to tensors
Trait Implementations§
Source§impl Dataset for DatabaseDataset
impl Dataset for DatabaseDataset
Source§type Item = DatabaseRow
type Item = DatabaseRow
The type of items returned by the dataset
Auto Trait Implementations§
impl Freeze for DatabaseDataset
impl !RefUnwindSafe for DatabaseDataset
impl Send for DatabaseDataset
impl Sync for DatabaseDataset
impl Unpin for DatabaseDataset
impl !UnwindSafe for DatabaseDataset
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.