pub struct TableMetadata {
pub schema: Table,
pub record_pk_column: Option<usize>,
pub user_id_columns: Vec<usize>,
pub json_metadata: JsonMetadata,
/* private fields */
}Expand description
A data class describing a sqlite Table and additional meta data useful for TrailBase.
An example of TrailBase idiosyncrasies are UUIDv7 columns, which are a bespoke concept.
Fields§
§schema: Table§record_pk_column: Option<usize>If and which column on this table qualifies as a record PK column, i.e. integer or UUIDv7.
user_id_columns: Vec<usize>If and which columns on this table reference _user(id).
json_metadata: JsonMetadataMetadata for CHECK(json_schema()) columns.
Implementations§
Source§impl TableMetadata
impl TableMetadata
Sourcepub fn new(table: Table, tables: &[Table], user_table_name: &str) -> Self
pub fn new(table: Table, tables: &[Table], user_table_name: &str) -> Self
Build a new TableMetadata instance containing TrailBase/RecordApi specific information.
NOTE: The list of all tables is needed only to extract interger/UUIDv7 pk columns for foreign key relationships.
pub fn name(&self) -> &QualifiedName
pub fn column_index_by_name(&self, key: &str) -> Option<usize>
pub fn column_by_name(&self, key: &str) -> Option<(usize, &Column)>
Trait Implementations§
Source§impl Borrow<QualifiedName> for TableMetadata
impl Borrow<QualifiedName> for TableMetadata
Source§fn borrow(&self) -> &QualifiedName
fn borrow(&self) -> &QualifiedName
Immutably borrows from an owned value. Read more
Source§impl Clone for TableMetadata
impl Clone for TableMetadata
Source§fn clone(&self) -> TableMetadata
fn clone(&self) -> TableMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TableMetadata
impl Debug for TableMetadata
impl Eq for TableMetadata
Source§impl Hash for TableMetadata
impl Hash for TableMetadata
Source§impl PartialEq for TableMetadata
impl PartialEq for TableMetadata
Source§impl TableOrViewMetadata for TableMetadata
impl TableOrViewMetadata for TableMetadata
fn qualified_name(&self) -> &QualifiedName
fn columns(&self) -> Option<&[Column]>
fn json_metadata(&self) -> Option<&JsonMetadata>
fn record_pk_column(&self) -> Option<(usize, &Column)>
Auto Trait Implementations§
impl Freeze for TableMetadata
impl RefUnwindSafe for TableMetadata
impl Send for TableMetadata
impl Sync for TableMetadata
impl Unpin for TableMetadata
impl UnsafeUnpin for TableMetadata
impl UnwindSafe for TableMetadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
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 more