pub struct TableRef<'a> { /* private fields */ }Expand description
A metadata-only view of a TABLE and its optional related TABLE DATA entry.
This handle borrows metadata parsed and indexed by crate::Archive::open. Creating
or querying it does not seek to or decompress table data. Schema, table, and column
identities are byte-oriented.
Row representation and column-layout queries deliberately distinguish unavailable metadata, malformed COPY metadata, and unsupported table-data representations. Raw selected-entry access remains separate and may still be possible for a representation the row parser does not support.
Implementations§
Source§impl<'a> TableRef<'a>
impl<'a> TableRef<'a>
Sourcepub fn schema(&self) -> Option<&[u8]>
pub fn schema(&self) -> Option<&[u8]>
Returns table namespace bytes, or None when the TABLE namespace was NULL.
Sourcepub const fn table_entry_id(&self) -> DumpId
pub const fn table_entry_id(&self) -> DumpId
Returns the dump ID of the TABLE TOC entry.
Sourcepub fn data_entry_id(&self) -> Option<DumpId>
pub fn data_entry_id(&self) -> Option<DumpId>
Returns the dump ID of the related TABLE DATA entry, when present.
None means the metadata index found no related table-data entry.
Sourcepub fn data_representation(
&self,
) -> Result<TableDataRepresentation, PgDumpError>
pub fn data_representation( &self, ) -> Result<TableDataRepresentation, PgDumpError>
Returns the table-data representation derived from stored TOC metadata.
CopyText, Insert, Binary, and other recognized states are values. If the
representation cannot be derived because metadata is absent or malformed, this
returns the corresponding typed metadata error instead.
Sourcepub fn columns(&self) -> Result<&[Column], PgDumpError>
pub fn columns(&self) -> Result<&[Column], PgDumpError>
Returns COPY columns in the exact positional order used by parsed rows.
Missing table-data/COPY metadata, malformed COPY statements, and unsupported
table-data representations are reported distinctly. This metadata-only call does
not decompress data. Raw entry access remains available through
crate::Archive::entry_reader when the selected entry itself is readable.
Sourcepub fn column_index(&self, name: &[u8]) -> Result<Option<usize>, PgDumpError>
pub fn column_index(&self, name: &[u8]) -> Result<Option<usize>, PgDumpError>
Resolves an exact byte-oriented COPY column name to its zero-based field index.
Ok(Some(index)) means valid metadata contained the name. Ok(None) means
metadata was valid but the name was absent. Metadata unavailable/malformed and
unsupported representations are returned as distinct typed errors.